- Improve startup speed, by using a faster remote server to get the host's machine public IP. This also reduces the risk of not being able to get the public IP at all.

- Set the App to gracefully shut down the WebServer and wait up to 2 minutes.
- Increase the waiting time for the "PublicationsRetriever.executor" to shut down, to 2 minutes.
This commit is contained in:
Lampros Smyrnaios 2023-05-23 20:17:58 +03:00
parent 4d90846261
commit 9cb43b3d94
3 changed files with 5 additions and 2 deletions

View File

@ -76,7 +76,7 @@ public class UrlsWorkerApplication {
logger.info("Shutting down the threads used by \"PublicationsRetriever\"-plugin..");
PublicationsRetriever.executor.shutdown(); // Define that no new tasks will be scheduled.
try {
if ( !PublicationsRetriever.executor.awaitTermination(1, TimeUnit.MINUTES) ) {
if ( !PublicationsRetriever.executor.awaitTermination(2, TimeUnit.MINUTES) ) {
logger.warn("The working threads did not finish on time! Stopping them immediately..");
PublicationsRetriever.executor.shutdownNow();
}

View File

@ -55,7 +55,7 @@ public class UriBuilder {
{
String publicIpAddress = "";
HttpURLConnection conn = null;
String urlString = "https://api.ipify.org/";
String urlString = "https://checkip.amazonaws.com/";
try {
conn = (HttpURLConnection) new URL(urlString).openConnection();
conn.setConnectTimeout(60_000); // 1 minute

View File

@ -15,6 +15,9 @@ server.port = 1881
# Server api path
server.servlet.context-path=/api
server.shutdown=graceful
spring.lifecycle.timeout-per-shutdown-phase=2m
#Input data configurations
info.workerId = XX