pool package is designed to run multiple goroutines at request. aggregator and accumulator starts a pool worker every 400 and 250ms, respectively. In both cases workers write data to redis and postgres db.
As an average case, we don't expect any race condition. But as an edge case, we might end up with:
multiple workers running simultaneously
the latest workers write to db first
followed by the earlier workers
in which case the db will end up with outdated data
pool
package is designed to run multiple goroutines at request.aggregator
andaccumulator
starts a pool worker every 400 and 250ms, respectively. In both cases workers write data to redis and postgres db.As an average case, we don't expect any race condition. But as an edge case, we might end up with: