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 51eda75 commit 48db706
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -359,11 +359,11 @@ class LongPollingClient implements Runnable {
@Override
public void run() {
try {
this.asyncTimeoutFuture = scheduler.schedule(() -> {
this.asyncTimeoutFuture = scheduler.scheduleWithFixedDelay(() -> {
clients.remove(LongPollingClient.this);
List<ConfigGroupEnum> changedGroups = compareChangedGroup((HttpServletRequest) asyncContext.getRequest());
sendResponse(changedGroups);
}, timeoutTime, TimeUnit.MILLISECONDS);
}, 0, timeoutTime, TimeUnit.MILLISECONDS);
clients.add(this);
} catch (Exception ex) {
log.error("add long polling client error", ex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ private void fetchGroupConfig(final ConfigGroupEnum... groups) throws ShenyuExce
}
}

private void doFetchGroupConfig(final String server, final ConfigGroupEnum... groups) {
private synchronized void doFetchGroupConfig(final String server, final ConfigGroupEnum... groups) {
StringBuilder params = new StringBuilder();
for (ConfigGroupEnum groupKey : groups) {
params.append("groupKeys").append("=").append(groupKey.name()).append("&");
Expand All @@ -155,7 +155,7 @@ private void doFetchGroupConfig(final String server, final ConfigGroupEnum... gr
}
// not updated. it is likely that the current config server has not been updated yet. wait a moment.
LOG.info("The config of the server[{}] has not been updated or is out of date. Wait for listening for changes again.", server);
ThreadUtils.sleep(TimeUnit.SECONDS, 3);
ThreadUtils.sleep(TimeUnit.SECONDS, 30);
}


Expand All @@ -180,6 +180,7 @@ private void doLongPolling(final String server) {
params.put(group.name(), Lists.newArrayList(value));
}
}
LOG.debug("listener params: [{}]", params);
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
headers.set(Constants.X_ACCESS_TOKEN, this.accessTokenManager.getAccessToken());
Expand Down

0 comments on commit 48db706

Please sign in to comment.