-
Notifications
You must be signed in to change notification settings - Fork 320
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(pindexer): optional exit-on-catchup #5101
Conversation
return Ok(()); | ||
if exit_on_catchup { | ||
tracing::info!("catchup completed, exiting as requested"); | ||
std::process::exit(0); |
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.
It's a bit of a hack to std::process::exit()
here. Perhaps we should instead return a custom Result::CatchUp that triggers an exit in the main loop? Didn't seem worthwhile for a quick feature add, but open to suggestions.
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.
I wrote up a quick commit to avoid std::process::exit: #5103 ; I think I'd like to see that included in this PR (or something equivalent). Result<bool>
seems fine enough to capture the possibilities there, and avoids the woes of direct exits, in case we want to run this code in a different context.
For running batch jobs managing indexing pipelines, it'd be convenient to instruct pindexer to exit after it's finished processing the events that's available to it. This situation arises frequently in batch processing, where pindexer will be pointed at a source db that was restored from a db. Having pindexer exit 0 on success, else non-zero on error, will aid in building out test infrastructure.
d6e91a1
to
b530dfc
Compare
some suggested changes to #5101
Thanks @cronokirby, that change is just what I was looking for! |
Describe your changes
For running batch jobs managing indexing pipelines, it'd be convenient to instruct pindexer to exit after it's finished processing the events that's available to it. This situation arises frequently in batch processing, where pindexer will be pointed at a source db that was restored from a db. Having pindexer exit 0 on success, else non-zero on error, will aid in building out test infrastructure.
Issue ticket number and link
N/A
Checklist before requesting a review
If this code contains consensus-breaking changes, I have added the "consensus-breaking" label. Otherwise, I declare my belief that there are not consensus-breaking changes, for the following reason: