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

'No sync target' logging improvements #4853

Merged
merged 11 commits into from
Jan 16, 2023
Prev Previous commit
Next Next commit
PR fixes.
Signed-off-by: mark-terry <mark.terry@consensys.net>
  • Loading branch information
mark-terry committed Jan 11, 2023
commit f8f02890eb2f2462421d5db1b6505a7644077369
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,14 @@ public static void throttledLog(
final String logMessage,
final AtomicBoolean shouldLog,
final int logRepeatDelay) {

final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();
mark-terry marked this conversation as resolved.
Show resolved Hide resolved

if (shouldLog.compareAndSet(true, false)) {
logger.accept(logMessage);
final ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor();

final Runnable runnable =
() -> {
shouldLog.set(true);
executor.shutdown();
};
() -> shouldLog.set(true);
executor.schedule(runnable, logRepeatDelay, TimeUnit.SECONDS);
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright ConsenSys AG.
* Copyright Hyperledger Besu Contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
Expand Down