Skip to content

Commit

Permalink
Merge pull request #57 from beclab/fix_i18n_no_data
Browse files Browse the repository at this point in the history
fix: i18n API no data
  • Loading branch information
icebergtsn authored Dec 17, 2024
2 parents 132d629 + bc7ea7c commit 2ef10e6
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions internal/appmgr/cache_for_api.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,17 @@ func ReadCacheApplicationsWithMap(names []string) map[string]*models.Application

result := make(map[string]*models.ApplicationInfo)

// If names is an empty array, return all data
if len(names) == 0 {
for _, app := range cacheApplications {
copyApp := deepCopyApplication(app)
result[app.Name] = copyApp
}
glog.Infof("---------->on ReadCacheApplicationsWithMap: Returning all applications, count: %s", len(result))
return result
}

// Otherwise, return the specified applications by name
for _, name := range names {
for _, app := range cacheApplications {
if app.Name == name {
Expand All @@ -267,6 +278,27 @@ func ReadCacheApplicationsWithMap(names []string) map[string]*models.Application
return result
}

// func ReadCacheApplicationsWithMap(names []string) map[string]*models.ApplicationInfo {
// mu.Lock() // Lock to ensure thread safety
// defer mu.Unlock()

// result := make(map[string]*models.ApplicationInfo)

// for _, name := range names {
// for _, app := range cacheApplications {
// if app.Name == name {
// copyApp := deepCopyApplication(app)
// result[name] = copyApp
// break
// }
// }
// }

// glog.Infof("---------->on ReadCacheApplicationsWithMap: %s", len(result))

// return result
// }

func updateCacheI18n() {
for _, app := range cacheApplications {
i18nData := getAppI18n(app.ChartName, app.Locale)
Expand Down

0 comments on commit 2ef10e6

Please sign in to comment.