Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ISSUE #3781]Fix service list intermittently lost service #3891

Merged
merged 8 commits into from
Sep 23, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
update serviceManager
  • Loading branch information
binbin0325 committed Sep 23, 2020
commit a0eca7b05be8ee9f00d0bbf8e007d3aaca030af5
Original file line number Diff line number Diff line change
Expand Up @@ -711,18 +711,12 @@ public void putService(Service service) {
}
}
}
Map map = serviceMap.get(service.getNamespaceId());
synchronized (map) {
if (map.get(service.getName()) == null) {
service.init();
}
map.put(service.getName(), service);
}

serviceMap.get(service.getNamespaceId()).put(service.getName(), service);
}

private void putServiceAndInit(Service service) throws NacosException {
putService(service);
service.init();
consistencyService
.listen(KeyBuilder.buildInstanceListKey(service.getNamespaceId(), service.getName(), true), service);
consistencyService
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static ScheduledFuture<?> scheduleCheck(HealthCheckTask task) {
* @param task client beat check task
*/
public static void scheduleCheck(ClientBeatCheckTask task) {
futureMap.put(task.taskKey(), GlobalExecutor.scheduleNamingHealth(task, 5000, 5000, TimeUnit.MILLISECONDS));
futureMap.putIfAbsent(task.taskKey(), GlobalExecutor.scheduleNamingHealth(task, 5000, 5000, TimeUnit.MILLISECONDS));
}

/**
Expand Down