Closed adwski closed 4 days ago
Attention: Patch coverage is 90.67797%
with 11 lines
in your changes missing coverage. Please review.
Project coverage is 41.33%. Comparing base (
08c3ba6
) to head (5ca728f
). Report is 11 commits behind head on master.
Files | Patch % | Lines |
---|---|---|
internal/pool/pool.go | 93.81% | 6 Missing :warning: |
internal/query/result_set.go | 66.66% | 5 Missing :warning: |
:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.
Pull request type
Please check the type of change your PR introduces:
What is the current behavior?
Current approach has couple shortcomings:
What is the new behavior?
I propose to use buffered channel to manage query pool items as oppose to index map and idle slice. This approach makes item creation process continuous and asynchronous, which allows seamlessly warm-up pool or re-establish all connections after connectivity failure.
Internally I introduced:
getItem() and putItem() are working with item queue - receiving or sending back items. New thing about getItem() is that it ensures that retrieved item is ok to use (as far IsAlive() can tell). To achieve this it spins in endless loop until in can receive item from queue. This means in case of connectivity failure or pool starvation it will block causing back pressure to caller (who should use context with deadline if it wishes to not block as well but detect this situation).
Other information
To discuss:
In this approach 'index' stat is not used. Should we get rid of it if the changes will be given green light?