[bisq-network/bisq] Use the index of a seed node address in the list of nodes at the (#4445)

chimp1984 notifications at github.com
Fri Aug 28 18:59:34 UTC 2020


@chimp1984 commented on this pull request.



> +        // We wrap our periodic check in a delay of 2 hours to avoid that we get
+        // triggered multiple times after a restart while being in the same hour. It can be that we miss our target
+        // hour during that delay but that is not considered problematic, the seed would just restart a bit longer than
+        // 24 hours.
+        int target = myIndex;
+        UserThread.runAfter(() -> {
+            // We check every hour if we are in the target hour.
+            UserThread.runPeriodically(() -> {
+                int currentHour = ZonedDateTime.ofInstant(Instant.now(), ZoneId.of("GMT0")).getHour();
+                if (currentHour == target) {
+                    log.warn("\n\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n" +
+                            "Shut down node at hour {}" +
+                            "\n%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%\n\n", target);
+                    shutDown(gracefulShutDownHandler);
+                }
+            }, TimeUnit.MINUTES.toSeconds(10));

CHECK_SHUTDOWN_SEC is 1 hour. That has risk that we miss the hour we are targeting. With 10 min. Its safe enough and does not cause performance costs. We could maybe go higher like 30 min as well...but prefer to keep it on the safe side.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/4445#discussion_r479482738
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20200828/4cfe8d64/attachment-0001.html>


More information about the bisq-github mailing list