Refactor rg-ipfs queue #141
Labels
enhancement
New feature or request
improvement
Improve on existing feature
P-High
High Priority
refactoring
Major change to features
The current queue is setup as a map which would check for peers connection status and send messages accordingly if they are online, however this would create a bottleneck with large amounts of messages and events stored in queue and would not be scalable since we check one peer at a time.
The queue should be refactored to be its own struct that would handle each peer as a entry with a separate task performing checks on each entry. When we wish to add something to queue for that specific peer, we would use a function to the queue that would send the data to the entry, If there one available. If there is no entry for said peer then one would be created. Inside each entry would contain a separate tokio task that would run and would perform a check on the peer connectivity. Once the peer is confirmed to be online, we would deliver all the entries supplied. After everything was delivered, we would signal that the queue entry is empty and the queue, which would also have its own task, would check each entry for its status and after seeing any items marked empty would begin a timer which would mark the removal the entry at the end of the timer.
Each entry would be saved in its own file that would be load into its own entry points and begin the task after loading it into memory.
Notes:
The text was updated successfully, but these errors were encountered: