timgit / pg-boss

Queueing jobs in Postgres from Node.js like a boss
MIT License
2.13k stars 158 forks source link

Supervisor causing tests to hang #217

Closed sdn90 closed 3 years ago

sdn90 commented 3 years ago

I was unable to get my tests to cleanly teardown with start and stop. Once I set noSupervisor: true, everything worked.

pg-boss: 5.0.8 pg: 8.5.1

timgit commented 3 years ago

pg-boss's test suite runs on every commit and is running fine. What tests are you referring to?

sdn90 commented 3 years ago

Hi, sorry for the short report. Thanks for your work on this library btw -- it's been working really well for me!

In my codebase I'm using Jest for tests and my setup/teardown looks like this:

beforeAll(() => pgBoss.start())
afterEach(() => pgBoss.deleteAllQueues())
afterAll(() => pgBoss.stop())

Without noSupervisor: true, my tests won't exit unless I send a SIGINT. I'm guessing its due to a connection or timer being active.

I had similar setup with the older API and never had an issue until the scheduling feature was introduced.

timgit commented 3 years ago

Thanks! I'm not sure what action I can take based on this. These are all promise resolving, and I can confirm all of these functions properly resolve, or else pg-boss's suite wouldn't work either.