- 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:
parent
4d90846261
commit
9cb43b3d94
|
@ -76,7 +76,7 @@ public class UrlsWorkerApplication {
|
||||||
logger.info("Shutting down the threads used by \"PublicationsRetriever\"-plugin..");
|
logger.info("Shutting down the threads used by \"PublicationsRetriever\"-plugin..");
|
||||||
PublicationsRetriever.executor.shutdown(); // Define that no new tasks will be scheduled.
|
PublicationsRetriever.executor.shutdown(); // Define that no new tasks will be scheduled.
|
||||||
try {
|
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..");
|
logger.warn("The working threads did not finish on time! Stopping them immediately..");
|
||||||
PublicationsRetriever.executor.shutdownNow();
|
PublicationsRetriever.executor.shutdownNow();
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class UriBuilder {
|
||||||
{
|
{
|
||||||
String publicIpAddress = "";
|
String publicIpAddress = "";
|
||||||
HttpURLConnection conn = null;
|
HttpURLConnection conn = null;
|
||||||
String urlString = "https://api.ipify.org/";
|
String urlString = "https://checkip.amazonaws.com/";
|
||||||
try {
|
try {
|
||||||
conn = (HttpURLConnection) new URL(urlString).openConnection();
|
conn = (HttpURLConnection) new URL(urlString).openConnection();
|
||||||
conn.setConnectTimeout(60_000); // 1 minute
|
conn.setConnectTimeout(60_000); // 1 minute
|
||||||
|
|
|
@ -15,6 +15,9 @@ server.port = 1881
|
||||||
|
|
||||||
# Server api path
|
# Server api path
|
||||||
server.servlet.context-path=/api
|
server.servlet.context-path=/api
|
||||||
|
server.shutdown=graceful
|
||||||
|
|
||||||
|
spring.lifecycle.timeout-per-shutdown-phase=2m
|
||||||
|
|
||||||
#Input data configurations
|
#Input data configurations
|
||||||
info.workerId = XX
|
info.workerId = XX
|
||||||
|
|
Loading…
Reference in New Issue