-
Notifications
You must be signed in to change notification settings - Fork 418
[BugFix] RoundRobinWriter, possible duplicated code in the extend method #709
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
Conversation
Codecov Report
@@ Coverage Diff @@
## main #709 +/- ##
==========================================
+ Coverage 88.77% 88.81% +0.04%
==========================================
Files 122 122
Lines 21151 21142 -9
==========================================
+ Hits 18776 18778 +2
+ Misses 2375 2364 -11
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! The implementation was odd, I agree.
Could you add a test in TestPrototypeBuffers to check that the cursor moves to the right position in the following cases:
- Fill the replay buffer with less data than the storage max size (N < M)
- Fill the replay buffer with as much data as storage max size (N=M), and add some more data in a second time with less data (N<M) => the cursor should be at N
- Fill the replay buffer directly with more data than the storage max size (N > M), the cursor should be at N-M
vmoens
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Thanks agains for spotting this and solving it!
|
I think the extend method in the ReplayBuffer from replay_buffers.py also can be simplified. I added the same changes I suggested for RoundRobinWriter and also added tests. |
Cool thanks for that too! |
Description
In the class RoundRobinWriter, in the extend method, seems like some of the conditions could be unnecessary. Maybe I am missing something, but if
cur_size = self._cursorseems like the last two conditions are duplicated code. The code raises no error, but maybe the extra conditions can be removed.
Types of changes
What types of changes does your code introduce? Remove all that do not apply:
Checklist
Go over all the following points, and put an
xin all the boxes that apply.If you are unsure about any of these, don't hesitate to ask. We are here to help!