Skip to content

Commit

Permalink
fix TODO
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewazores committed Mar 23, 2023
1 parent 37dda49 commit 4db6f60
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 4 additions & 2 deletions src/main/java/io/cryostat/agent/MainModule.java
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,10 @@ public static WebServer provideWebServer(
ScheduledExecutorService executor,
@Named(ConfigModule.CRYOSTAT_AGENT_WEBSERVER_HOST) String host,
@Named(ConfigModule.CRYOSTAT_AGENT_WEBSERVER_PORT) int port,
Lazy<Registration> registration) {
return new WebServer(remoteContexts, cryostat, executor, host, port, registration);
Lazy<Registration> registration,
@Named(ConfigModule.CRYOSTAT_AGENT_REGISTRATION_RETRY_MS) int registrationRetryMs) {
return new WebServer(
remoteContexts, cryostat, executor, host, port, registration, registrationRetryMs);
}

@Provides
Expand Down
7 changes: 5 additions & 2 deletions src/main/java/io/cryostat/agent/WebServer.java
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ class WebServer {
private final int port;
private final Credentials credentials;
private final Lazy<Registration> registration;
private final int registrationRetryMs;
private HttpServer http;
private volatile int credentialId = -1;

Expand All @@ -92,14 +93,16 @@ class WebServer {
ScheduledExecutorService executor,
String host,
int port,
Lazy<Registration> registration) {
Lazy<Registration> registration,
int registrationRetryMs) {
this.remoteContexts = remoteContexts;
this.cryostat = cryostat;
this.executor = executor;
this.host = host;
this.port = port;
this.credentials = new Credentials();
this.registration = registration;
this.registrationRetryMs = registrationRetryMs;

this.agentAuthenticator = new AgentAuthenticator();
this.requestLoggingFilter = new RequestLoggingFilter();
Expand Down Expand Up @@ -163,7 +166,7 @@ void generateCredentials(CompletableFuture<Void> future) throws NoSuchAlgorithmE
log.error("Cannot submit credentials", e);
}
},
5000, // TODO reuse registrationRetryMs
registrationRetryMs,
TimeUnit.MILLISECONDS);
} else {
future.complete(null);
Expand Down

0 comments on commit 4db6f60

Please sign in to comment.