-
Notifications
You must be signed in to change notification settings - Fork 91
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
feat(spooler): Implement shutdown behavior in the spooler #3980
Conversation
The big question I have for this PR, is which strategy should we employ to deal with the envelopes in the stacks? To me, the strategy depends on the implementation:
In general, given the shutdown time bound, we still don't have to guarantee full persistence of envelopes but we can do a best effort. |
// Currently, we want to flush the buffer only for disk, since the in memory implementation | ||
// tries to not do anything and pop as many elements as possible within the shutdown | ||
// timeout. | ||
let Self::Sqlite(buffer) = self else { |
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.
Decided to branch out here and not call any flush
method on the memory impl, since I didn't want to make the flushing empty in the provider or stack, since it made no sense.
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.
Excellent choice!
nit: I would prefer an explicit match
on all variants here. If we ever add, let's say, a CloudStorageEnvelopeBuffer
, the compiler would then force us to implement the new match arm.
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.
Yes, that's a good point. I initially implemented it that way, but felt it was too verbose. But your argument makes it a more valid approach! Will fix
// Currently, we want to flush the buffer only for disk, since the in memory implementation | ||
// tries to not do anything and pop as many elements as possible within the shutdown | ||
// timeout. | ||
let Self::Sqlite(buffer) = self else { |
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.
Excellent choice!
nit: I would prefer an explicit match
on all variants here. If we ever add, let's say, a CloudStorageEnvelopeBuffer
, the compiler would then force us to implement the new match arm.
This PR implements the shutdown behavior in the spooler which works in the following way:
Note that cancellation of the shutdown procedure might lead to data loss based on the progress w.r.t. the await points.
Closes: https://github.com/getsentry/team-ingest/issues/529