Skip to content

Commit

Permalink
[type:fix] e2e test error
Browse files Browse the repository at this point in the history
  • Loading branch information
moremind committed Oct 21, 2023
1 parent 0914a8e commit 51eda75
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,12 @@ public final void afterPropertiesSet() {
* @param data the new config data
*/
protected <T> void updateCache(final ConfigGroupEnum group, final List<T> data) {
String json = GsonUtils.getInstance().toJson(data);
ConfigDataCache newVal = new ConfigDataCache(group.name(), json, DigestUtils.md5Hex(json), System.currentTimeMillis());
ConfigDataCache oldVal = CACHE.put(newVal.getGroup(), newVal);
LOG.info("update config cache[{}], old: {}, updated: {}", group, oldVal, newVal);
synchronized (CACHE) {
String json = GsonUtils.getInstance().toJson(data);
ConfigDataCache newVal = new ConfigDataCache(group.name(), json, DigestUtils.md5Hex(json), System.currentTimeMillis());
ConfigDataCache oldVal = CACHE.put(newVal.getGroup(), newVal);
LOG.info("update config cache[{}], old: {}, updated: {}", group, oldVal, newVal);
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ private boolean checkCacheDelayAndUpdate(final ConfigDataCache serverCache, fina
if (latest != serverCache) {
return !StringUtils.equals(clientMd5, latest.getMd5());
}
synchronized (this) {
synchronized (CACHE) {
latest = CACHE.get(serverCache.getGroup());
if (latest != serverCache) {
return !StringUtils.equals(clientMd5, latest.getMd5());
Expand Down

0 comments on commit 51eda75

Please sign in to comment.