algorand / conduit

Algorand's data pipeline framework.
MIT License
37 stars 26 forks source link

Make `pipeline.NextRound` atomic #140

Open tzaffi opened 1 year ago

tzaffi commented 1 year ago

Problem

The pipeline's NextRound is updated at the end of every round but accessed in several contexts that could be running in go-routines. A workaround we use atomic.LoadUint64 but that is no longer considered a best practice.

Solution

Consider using pipeline.NextRound.Load() and similar functions for updating the variable.

Caveat Emptor

This exact approach may not be backwards compatible on some 32-bit systems: https://go101.org/article/memory-layout.html

Dependencies

Should wait until #128 is merged

Urgency

Low