Closed amc6 closed 2 years ago
This was intentional, but primarily not for this use case. The current logic is "if start() hasn't been called, then how do we know the schema has been installed?" This is safe to do only after start() has been called. We could introduce a new state bool on start to indicate it's safe to call publish() and insert()
Yeah that makes sense. Thanks!
It appears that calling
pgboss.stop()
causes subsequent calls topublish()
to fail.In my use case, I want to be able to stop running new jobs when we know that the old instance is being destroyed during a deployment. But jobs already in progress should be allowed to complete, and some of them publish new jobs. The
graceful
flags allows these jobs to keep running, but they are still prevented from publishing. Continuing to publish should be safe as long as it doesn't start new jobs on the stopping instance.For now, I've worked around this issue by instead just unsubscribing from every subscription instead of calling
stop()
. But this requires more bookkeeping, and I would imagine my use-case may be common. Thanks!