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

refactor(boot): increases wait timeout for servlets initialization #8947

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,9 @@ bootstrap:
enabled: ${UPGRADE_DEFAULT_BROWSE_PATHS_ENABLED:false} # enable to run the upgrade to migrate legacy default browse paths to new ones
backfillBrowsePathsV2:
enabled: ${BACKFILL_BROWSE_PATHS_V2:false} # Enables running the backfill of browsePathsV2 upgrade step. There are concerns about the load of this step so hiding it behind a flag. Deprecating in favor of running through SystemUpdate
servlets:
waitTimeout: ${BOOTSTRAP_SERVLETS_WAITTIMEOUT:60} # Total waiting time in seconds for servlets to initialize


systemUpdate:
initialBackOffMs: ${BOOTSTRAP_SYSTEM_UPDATE_INITIAL_BACK_OFF_MILLIS:5000}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,18 @@
import org.apache.http.impl.client.HttpClients;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import org.springframework.web.context.WebApplicationContext;
import org.springframework.context.annotation.Configuration;


/**
* Responsible for coordinating starting steps that happen before the application starts up.
*/
@Configuration
@Slf4j
@Component
public class OnBootApplicationListener {
Expand All @@ -44,6 +47,8 @@ public class OnBootApplicationListener {
@Qualifier("configurationProvider")
private ConfigurationProvider provider;

@Value("${bootstrap.servlets.waitTimeout}")
private int _servletsWaitTimeout;

@EventListener(ContextRefreshedEvent.class)
public void onApplicationEvent(@Nonnull ContextRefreshedEvent event) {
Expand All @@ -62,7 +67,7 @@ public void onApplicationEvent(@Nonnull ContextRefreshedEvent event) {
public Runnable isSchemaRegistryAPIServletReady() {
return () -> {
final HttpGet request = new HttpGet(provider.getKafka().getSchemaRegistry().getUrl());
int timeouts = 30;
int timeouts = _servletsWaitTimeout;
boolean openAPIServeletReady = false;
while (!openAPIServeletReady && timeouts > 0) {
try {
Expand All @@ -79,7 +84,7 @@ public Runnable isSchemaRegistryAPIServletReady() {
timeouts--;
}
if (!openAPIServeletReady) {
log.error("Failed to bootstrap DataHub, OpenAPI servlet was not ready after 30 seconds");
log.error("Failed to bootstrap DataHub, OpenAPI servlet was not ready after {} seconds", timeouts);
System.exit(1);
} else {
_bootstrapManager.start();
Expand Down
Loading