storj/satellite/accounting/rollup
Isaac Hess d5d0c442ac satellite/accounting/rollup: Use lastRollup as zero-value
In satellite/accounting/rollup Service.RollupStorage we have a few
potential error scenarios that return time.Now(). Especially in the case
where we exit early because we have received 0 tallies since the *last*
rollup, this creates a potential race condition.

Between the time we call GetTalliesSince and realize it is empty, it's
possible a tally was inserted in that interval. As currently written we
are returning a latestTally time that excludes that tally.

We are currently protected because in Service.Rollup we don't save the
rollup unless we have populated the rollupStats. However, this change is
more correct and future-proof, because Service.RollupStorage should
always return a correct latestTally time, which in case of errors and
empty tallies, is the last successful tally.

Change-Id: I2521a2cc9802c8f06e512dde4422803a272e2a0a
2019-12-18 21:33:33 +00:00
..
common.go rename all the things (#2531) 2019-07-28 08:55:36 +03:00
rollup_test.go private: rename internal to private (#3573) 2019-11-14 21:46:15 +02:00
rollup.go satellite/accounting/rollup: Use lastRollup as zero-value 2019-12-18 21:33:33 +00:00