Skip to content

Commit

Permalink
Increase default network hub timeout to 60s. Add system property to c…
Browse files Browse the repository at this point in the history
…onfigure.
  • Loading branch information
neilcsmith-net committed Oct 3, 2024
1 parent aa10585 commit b3c73b9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
*/
class NetworkCoreRoot extends BasicCoreRoot {

private final static String PROXY_PREFIX = Hub.SYS_PREFIX + "proxy_";
static final int TIMEOUT = Integer.getInteger("praxis.hub.network.timeout", 60);

private static final String PROXY_PREFIX = Hub.SYS_PREFIX + "proxy_";

private final Hub.Accessor hubAccess;
private final List<ProxyData> proxies;
Expand Down Expand Up @@ -136,8 +138,8 @@ private void configure() {
var ctrl = installRoot(id, new ProxyClientRoot(info, clientEventLoopGroup,
services, childLauncher, serverInfo));
info.services().forEach(cls -> {
var address = ComponentAddress.of("/" + id + "/services/" +
Protocol.Type.of(cls).name());
var address = ComponentAddress.of("/" + id + "/services/"
+ Protocol.Type.of(cls).name());
hubAccess.registerService(cls, address);
});
proxies.add(new ProxyData(info, ComponentAddress.of("/" + id), ctrl));
Expand All @@ -161,8 +163,9 @@ private FileServer.Info activateFileServer() {
return null;
}

private record ProxyData(ProxyInfo info, ComponentAddress address, Root.Controller controller) {}
private record ProxyData(ProxyInfo info, ComponentAddress address, Root.Controller controller) {

}

private class AddRootControl extends AbstractAsyncControl {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ protected void update() {
var source = getExecutionContext();
if ((source.getTime() - lastPurgeTime) > TimeUnit.SECONDS.toNanos(1)) {
// LOG.fine("Triggering dispatcher purge");
dispatcher.purge(10, TimeUnit.SECONDS);
dispatcher.purge(NetworkCoreRoot.TIMEOUT, TimeUnit.SECONDS);
lastPurgeTime = source.getTime();
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ protected void update() {
long time = getExecutionContext().getTime();
if ((time - lastPurgeTime) > TimeUnit.SECONDS.toNanos(1)) {
LOG.log(Level.TRACE, "Triggering dispatcher purge");
dispatcher.purge(10, TimeUnit.SECONDS);
dispatcher.purge(NetworkCoreRoot.TIMEOUT, TimeUnit.SECONDS);
lastPurgeTime = time;
}
}
Expand Down

0 comments on commit b3c73b9

Please sign in to comment.