Re:Running Large-Scale Graph Analytics with Memgraph and Nvi...
by mbuda on Wednesday August 17, 2022 @10:53AM
(#32497229)
Nice observation! That sleep is there in the case the queue is full, which means the caller can't put an additional element into it. The only option is to wait and see if the queue becomes less full... The hard question is for how long? Here we just added a fixed amount which was/is reasonable for our use-cases. Maybe/probably a better would be to implement exponential backoff https://en.wikipedia.org/wiki/Exponential_backoff, but that's a bit more complex (not too much). We never hit any limitation with the current implementation, if we do, we'll improve further!
I was surprised with what I found, especially the sleep after adding an element and the loop just before a spin-lock. Not sure, if this is a good implementation, I hope if a more knowledgable person could explain to me this piece of code.
```
```