File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
hedera-app/src/main/java/com/hedera/node/app/blocks/impl/streaming
hedera-config/src/main/java/com/hedera/node/config/data Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -72,10 +72,8 @@ public class BlockNodeConnectionManager {
72
72
*/
73
73
public static final Duration INITIAL_RETRY_DELAY = Duration .ofSeconds (1 );
74
74
/**
75
- * The amount of time the worker thread will sleep when there is no work available to process .
75
+ * The multiplier used for exponential backoff when retrying connections .
76
76
*/
77
- private static final int PROCESSOR_LOOP_DELAY_MS = 10 ;
78
-
79
77
private static final long RETRY_BACKOFF_MULTIPLIER = 2 ;
80
78
/**
81
79
* The maximum delay used for reties.
@@ -220,6 +218,18 @@ private int blockItemBatchSize() {
220
218
.blockItemBatchSize ();
221
219
}
222
220
221
+ /**
222
+ * The amount of time the worker thread will sleep when there is no work available to process.
223
+ *
224
+ * @return the sleep duration of the worker loop
225
+ */
226
+ private Duration workerLoopSleepDuration () {
227
+ return configProvider
228
+ .getConfiguration ()
229
+ .getConfigData (BlockStreamConfig .class )
230
+ .workerLoopSleepDuration ();
231
+ }
232
+
223
233
/**
224
234
* Extracts block node configurations from the specified configuration file.
225
235
*
@@ -549,8 +559,7 @@ private void blockStreamWorkerLoop() {
549
559
550
560
// Sleep for a short duration to avoid busy waiting
551
561
if (shouldSleep ) {
552
- // TODO: make sleep duration configurable
553
- Thread .sleep (PROCESSOR_LOOP_DELAY_MS );
562
+ Thread .sleep (workerLoopSleepDuration ());
554
563
}
555
564
} catch (final InterruptedException e ) {
556
565
logger .error ("Block stream worker interrupted" , e );
Original file line number Diff line number Diff line change @@ -33,7 +33,8 @@ public record BlockStreamConfig(
33
33
@ ConfigProperty (defaultValue = "2s" ) @ Min (0 ) @ NetworkProperty Duration blockPeriod ,
34
34
@ ConfigProperty (defaultValue = "256" ) @ Min (0 ) @ NetworkProperty int blockItemBatchSize ,
35
35
@ ConfigProperty (defaultValue = "5m" ) @ Min (0 ) @ NetworkProperty Duration blockBufferTtl ,
36
- @ ConfigProperty (defaultValue = "1s" ) @ Min (0 ) @ NetworkProperty Duration blockBufferPruneInterval ) {
36
+ @ ConfigProperty (defaultValue = "1s" ) @ Min (0 ) @ NetworkProperty Duration blockBufferPruneInterval ,
37
+ @ ConfigProperty (defaultValue = "10ms" ) @ Min (1 ) @ NodeProperty Duration workerLoopSleepDuration ) {
37
38
38
39
/**
39
40
* Whether to stream to block nodes.
You can’t perform that action at this time.
0 commit comments