Skip to content

"rsync for cloud storage" - Google Drive, S3, Dropbox, Backblaze B2, One Drive, Swift, Hubic, Wasabi, Google Cloud Storage, Azure Blob, Azure Files, Yandex Files

accounting: fix creating of global stats ignoring the config

Nick Craig-Woodc2bf300dd8e1
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) {