Skip to content

Commit 16f1d7e

Browse files
authored
Add TimeBoundLoggers to cleanup operations (#7807)
1 parent f8e7d5f commit 16f1d7e

1 file changed

Lines changed: 13 additions & 0 deletions

File tree

src/host/files_cleanup_timer.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#include "ccf/crypto/sha256_hash.h"
77
#include "ledger_filenames.h"
88
#include "snapshots/filenames.h"
9+
#include "time_bound_logger.h"
910
#include "timer.h"
1011

1112
#include <algorithm>
@@ -260,6 +261,9 @@ namespace asynchost
260261
committed_snapshots,
261262
size_t max_retained)
262263
{
264+
TimeBoundLogger log_if_slow(
265+
"Cleaning snapshots", std::chrono::seconds(1));
266+
263267
if (committed_snapshots.size() > max_retained)
264268
{
265269
// committed_snapshots is sorted descending by snapshot index, so the
@@ -292,6 +296,15 @@ namespace asynchost
292296
size_t max_retained,
293297
std::optional<size_t> snapshot_watermark = std::nullopt)
294298
{
299+
TimeBoundLogger log_if_slow(
300+
fmt::format(
301+
"Cleaning ledger chunks from {}, watermark={}",
302+
main_dir,
303+
snapshot_watermark.has_value() ?
304+
std::to_string(snapshot_watermark.value()) :
305+
"none"),
306+
std::chrono::seconds(1));
307+
295308
std::vector<std::pair<size_t, std::filesystem::path>> committed;
296309
try
297310
{

0 commit comments

Comments
 (0)