-
Notifications
You must be signed in to change notification settings - Fork 26
add ability to finish queue then stop recording #62
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
base: main
Are you sure you want to change the base?
Conversation
|
It has definitely helped. I removed my 100ms sleeps in my tests between calling void McapSink::stopRecording()
{
stopAcceptingSnapshots();
processQueuedSnapshots();
std::scoped_lock lk(mutex_);
if (writer_)
{
writer_->close();
writer_.reset();
}
}and still somehow my sinks bool McapSink::storeSnapshot(const DataTamer::Snapshot& snapshot)
{
std::scoped_lock lk(mutex_);
if (!writer_)
{
std::cerr << "[McapSink] storeSnapshot: mcap writer is null, skipping snapshot" << std::endl;
return false;
}
} |
|
@jlack1987 great thank you, I'll see if I can fix that and push a fix |
|
@jlack1987 are you using a custom mcap sink? Is there anyway I can see that? If not, does the So the only way to stop Is actually still going, since nothing ever sets the pimpl's With that sleep there before a second call to processQueuedSnapshots(). The docstring for try_dequeue says
So unfortunately I think some sleep is necessary to get any stragglers that may have still been enqueueing during the first Is there something stopping you from using the built-in mcap sink? Let me know if this all makes sense or if I've missed something |
|
If I use exactly the |
|
@jlack1987 ok, great! Glad to hear. Will merging this as-is resolve #61, then? |
|
Yeah I think we can call it solved, appreciate the support sir! |
|
@jlack1987 of course, glad I could help! I might leave this PR open a bit longer and re-review it myself and add some tests this weekend, but at the moment I don't foresee any functional changes so you should be good to use this branch until it's merged to main. |
Should resolve #61
@jlack1987 can you leave a review and confirm if this would provide the use case you'd like? If you want to add a more in-depth test case that would be appreciated, though I understand if it's impossible since it's basically reliant on a specific order of threads queuing things.
One open question is should we also change
stopRecordingto callstopAcceptingSnapshots? This would require changing the test but IMO is more aligned with the behavior I'd expect. If we don't want to keep the (slightly counterintuitive) existing behavior we could probably make this a cleaner change and remove theforced_stop_recording_variable fromMCAPSinkaltogether