-
Notifications
You must be signed in to change notification settings - Fork 39
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
Graceful shutdown on interrupt #46
Comments
Unfortunately I've never tried workwing with it too. |
@UFOMelkor it's really as simple as:
|
Note: Ctrl+C - SIGINT |
I looked into this for a little bit. It only works when |
Another thing is that |
ping @prolic @UFOMelkor |
If you want to handle all scenarios for interrupts and means of termination you will have to add additional signals to listen for (SIGTERM, SIGINT, SIGQUIT, (SIGHUB)). Only listening to SIGINT won't catch all instances of how a process can be forced to quit. This is a run wrapper we use on our end:
|
That's not really the goal here. I just want a fix for regular interrupt.
What scenario would be broken by dispatch in the projector persist method? As far as I can tell it seems to be a safe place for it.
I was thinking about something like that too but I still prefer to have it fixed in prooph. Besides this doesn't fix the problem of too long time between dispatch calls which is the main issue. |
That's an interrupt between applying the data and saving the information this data has been applied. As this is not running within an transaction, quiting before saving the state would result in an event applied in the read model (e.g. row created) but the state not persisted. E.g. on next start the event would be re-applied again. Now this is all old "at least once" delivery and "make your read models idempotent and can be handled to some extend in SQL directly. I'm wondering about how did your read model get corrupted? |
@fritz-gerneth that's no longer true, see prooph/pdo-event-store#144 |
@fritz-gerneth the change is released with v1.8.1 (https://github.com/prooph/pdo-event-store/releases/tag/v1.8.1) |
And here I was sitting on 1.8.0 :) v1.8.1 very well might solve this issue then :) |
I missed that PR too. That should solve my issues with dispatch then. Next we need a way to configure the options with this bundle:
|
I think we should pass |
I just encountered an issue where one of my projection was in an invalid state after being interrupted during previous run. The state of the projection was not saved to the database correctly
I believe the projection commands in this bundle could and should catch interruption signals like Ctrl+C and shutdown correctly when it happens using
pcntl_signal
function. Something like this (by @prolic):I'm not using the projection commands from this bundle at the moment but I'm going to refactor my project to use them soon. I might take a look into this then too.
Any tips what I should be aware of? I never tried working with
pcntl_signal
function until now.The text was updated successfully, but these errors were encountered: