From 545e0d47e1221cc6fcd24e1099500dabd7354a0a Mon Sep 17 00:00:00 2001 From: Ben Bierens <39762930+benbierens@users.noreply.github.com> Date: Mon, 4 Sep 2023 11:12:14 +0200 Subject: [PATCH] Slows down block maintenance iteration (#543) * Slows down block maintenance iteration * Fixes unstable integration test. --- codex/stores/maintenance.nim | 5 +++-- tests/integration/testblockexpiration.nim | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/codex/stores/maintenance.nim b/codex/stores/maintenance.nim index ce06dafa..4b80b6bb 100644 --- a/codex/stores/maintenance.nim +++ b/codex/stores/maintenance.nim @@ -42,9 +42,9 @@ proc new*( clock: Clock = SystemClock.new() ): BlockMaintainer = ## Create new BlockMaintainer instance - ## + ## ## Call `start` to begin looking for for expired blocks - ## + ## BlockMaintainer( repoStore: repoStore, interval: interval, @@ -78,6 +78,7 @@ proc runBlockCheck(self: BlockMaintainer): Future[void] {.async.} = if be =? await maybeBeFuture: inc numberReceived await self.processBlockExpiration(be) + await sleepAsync(50.millis) # If we received fewer blockExpirations from the iterator than we asked for, # We're at the end of the dataset and should start from 0 next time. diff --git a/tests/integration/testblockexpiration.nim b/tests/integration/testblockexpiration.nim index e1c417e3..29c18276 100644 --- a/tests/integration/testblockexpiration.nim +++ b/tests/integration/testblockexpiration.nim @@ -65,7 +65,7 @@ ethersuite "Node block expiration tests": let contentId = uploadTestFile() - await sleepAsync(2.seconds) + await sleepAsync(3.seconds) expect TimeoutError: discard downloadTestFile(contentId)