Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dev: fix udp ring-buffer not looping #846

Conversation

josecelano
Copy link
Member

@da2ce7's previous version would be limited to a single thread, as push_overwrite would keep on returning the last element when the ring-buffer was full.

Now, the ring-buffer is pre-filled and is looped over with a mutating iterator.

New handles are progressively swapped-in when the old entries are finished.

Note: I think that this implementation can be replaced with a standard vector with the same effect.

@josecelano josecelano added this to the v3.0.0 milestone May 8, 2024
@josecelano josecelano linked an issue May 8, 2024 that may be closed by this pull request
@josecelano josecelano requested a review from da2ce7 May 8, 2024 10:33
Copy link

codecov bot commented May 8, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.78%. Comparing base (218fbbe) to head (9e01f7f).

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #846      +/-   ##
===========================================
+ Coverage    78.64%   78.78%   +0.13%     
===========================================
  Files          163      163              
  Lines         9225     9252      +27     
===========================================
+ Hits          7255     7289      +34     
+ Misses        1970     1963       -7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@josecelano
Copy link
Member Author

The new test is failing on the runner but not on my machine 🤔

image

@da2ce7
Copy link
Contributor

da2ce7 commented May 8, 2024

@josecelano I've added a little delay to the test so it will pass:

da2ce7@fc7707c

My previous version would be limited to a single thread, as `push_overwrite` would keep on returning the last element when the ring-buffer was full.

Now the ring-buffer is pre-filled and is looped over with a mutating iterator.

New handles are progressively swapped-in when the old entries are finished.

Note: I think that this implementation can be replaced with a standard vector with the same effect.
@josecelano josecelano force-pushed the 842-review-process-to-abort-udp-request-when-the-ring-buffer-is-full branch from abb47b2 to 9e01f7f Compare May 8, 2024 14:47
@josecelano josecelano merged commit 31ab3a9 into torrust:develop May 8, 2024
17 checks passed
@josecelano
Copy link
Member Author

@josecelano I've added a little delay to the test so it will pass:

da2ce7@fc7707c

Updated and merged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Review process to abort UDP request when the ring buffer is full
2 participants