config: move account initialisation out into accounting

Before this change the initialisation for the accounting package was
done in the config package for some strange historical reason.
This commit is contained in:
Nick Craig-Wood
2021-03-11 17:29:26 +00:00
parent 1fed2d910c
commit a7fd65bf2d
4 changed files with 16 additions and 10 deletions
+12
View File
@@ -29,6 +29,18 @@ var ErrorMaxTransferLimitReachedFatal = fserrors.FatalError(ErrorMaxTransferLimi
// transfer limit is reached and a graceful stop is required.
var ErrorMaxTransferLimitReachedGraceful = fserrors.NoRetryError(ErrorMaxTransferLimitReached)
// Start sets up the accounting, in particular the bandwidth limiting
func Start(ctx context.Context) {
// Start the token bucket limiter
TokenBucket.StartTokenBucket(ctx)
// Start the bandwidth update ticker
TokenBucket.StartTokenTicker(ctx)
// Start the transactions per second limiter
StartLimitTPS(ctx)
}
// Account limits and accounts for one transfer
type Account struct {
stats *StatsInfo