mirror of
https://github.com/datahub-project/datahub.git
synced 2025-12-05 07:04:44 +00:00
refactor(boot): increases wait timeout for servlets initialization (#8947)
Co-authored-by: RyanHolstien <RyanHolstien@users.noreply.github.com>
This commit is contained in:
parent
3cede10ab3
commit
debac3cf5c
@ -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}
|
||||
|
||||
@ -15,15 +15,18 @@ import org.apache.http.impl.client.CloseableHttpClient;
|
||||
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 {
|
||||
@ -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) {
|
||||
@ -62,7 +67,7 @@ public class OnBootApplicationListener {
|
||||
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 {
|
||||
@ -79,7 +84,7 @@ public class OnBootApplicationListener {
|
||||
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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user