background-fetch icon indicating copy to clipboard operation
background-fetch copied to clipboard

Potential race with "Increment settledFetches by 1."

Open annevk opened this issue 6 years ago • 3 comments

Since this is done in parallel, it seems two threads could read settledFetches at a similar time, then increment it locally, and write out the result, leading to it only being incremented once rather than twice.

annevk avatar Oct 02 '18 12:10 annevk

I was hoping by using "increment" it would be clear that this should be atomic, but I'm happy to define incrementing using parallel queues.

jakearchibald avatar Oct 02 '18 12:10 jakearchibald

Yeah, once we have numbers defined we should really define this in Infra. Atomic makes sense, but if someone needs to increment by 2 and copies this pattern...

annevk avatar Oct 02 '18 12:10 annevk

if someone needs to increment by 2

This is pretty much what "complete a record" appears to be doing with "uploaded".

annevk avatar Oct 02 '18 12:10 annevk