From c2bf300dd8e1ebff0966ed2af7f572b7888ad62d Mon Sep 17 00:00:00 2001 From: Nick Craig-Wood Date: Thu, 11 Jul 2024 12:32:19 +0100 Subject: [PATCH] accounting: fix creating of global stats ignoring the config Before this change the global stats were created before the global config which meant they ignored the global config completely. --- fs/accounting/accounting.go | 6 ++++++ fs/accounting/stats_groups.go | 3 --- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/fs/accounting/accounting.go b/fs/accounting/accounting.go index f4cb57778..12c7db32f 100644 --- a/fs/accounting/accounting.go +++ b/fs/accounting/accounting.go @@ -39,6 +39,12 @@ func Start(ctx context.Context) { // Start the transactions per second limiter StartLimitTPS(ctx) + + // Set the error count function pointer up in fs + // + // We can't do this in an init() method as it uses fs.Config + // and that isn't set up then. + fs.CountError = GlobalStats().Error } // Account limits and accounts for one transfer diff --git a/fs/accounting/stats_groups.go b/fs/accounting/stats_groups.go index eaa3d2a2f..952b17596 100644 --- a/fs/accounting/stats_groups.go +++ b/fs/accounting/stats_groups.go @@ -17,9 +17,6 @@ var groups *statsGroups func init() { // Init stats container groups = newStatsGroups() - - // Set the function pointer up in fs - fs.CountError = GlobalStats().Error } func rcListStats(ctx context.Context, in rc.Params) (rc.Params, error) {