Reduce the window between creating and writing to files in contributor
ibaryshnikov opened this issue · comments
Contributor works like this:
- calls
try_lock
endpoint <- the files are initialized download/challenge
upload/response
try_contribute
<- the files are written to
As you can see, we have several requests before creating and using the files. And if the contributor or coordinator is stopped in between of these calls, there's a high chance to obtain incorrect state in the transcript.
What if we move the file initialization from try_lock
to try_contribute
? As a result, the files will be created right before being used, and it will reduce the window in which it's possible to obtain incorrect state by a lot.
If the contributor goes down, it will not affect the files at all, so we'll have to take care only about coordinator restarts.
I think this is great, as it potentially reduces the number of ways the contributor can fail.