diamondio/better-queue-sql

Please make acquireConnectionTimeout for sqlite configurable.

Closed this issue · 2 comments

acquireConnectionTimeout for sqlite in better-queue-sql is currently hardcoded to 200 (200ms or 0.2s). This appears to be too short for some scenarios. I've discovered a scenario where this works fine on a regular machine, but if I build and deploy my code inside a Docker container, I get errors of this form:

_bitField: 18087936,
Oct 20 16:43:03 creffield docker-tietogether[1284]:   _fulfillmentHandler0:
Oct 20 16:43:03 creffield docker-tietogether[1284]:    { TimeoutError: Knex: Timeout acquiring a connection. The pool is probably full. Are you missing a .transacting(trx) call?
Oct 20 16:43:03 creffield docker-tietogether[1284]:     at Timeout.<anonymous> (/usr/src/app/node_modules/knex/lib/client.js:287:18)
Oct 20 16:43:03 creffield docker-tietogether[1284]:     at Timeout._onTimeout (/usr/src/app/node_modules/async-listener/glue.js:188:31)
Oct 20 16:43:03 creffield docker-tietogether[1284]:     at ontimeout (timers.js:469:11)
Oct 20 16:43:03 creffield docker-tietogether[1284]:     at tryOnTimeout (timers.js:304:5)
Oct 20 16:43:03 creffield docker-tietogether[1284]:     at Timer.listOnTimeout (timers.js:264:5)
Oct 20 16:43:03 creffield docker-tietogether[1284]:      sql: 'CREATE TABLE IF NOT EXISTS tasks (id TEXT UNIQUE, lock TEXT, task TEXT, priority NUMERIC, added INTEGER PRIMARY KEY AUTOINCREMENT)',
Oct 20 16:43:03 creffield docker-tietogether[1284]:      bindings: undefined },

Because acquireConnectionTimeout is not configurable, I had to hack the version of better-queue-sql I was using to modify it. Please either make it configurable or increase it. Not sure if there is a reason for it to be so small?

Unfortunately, I haven't been actively developing this library and am looking for active contributors. If you would like to make a pull request, for it I can add that as quickly as possible.

Thanks for the PR. Published to 1.0.3