sequelize / sequelize-pool

Resource pool implementation. It can be used to throttle expensive resources.
Other
38 stars 17 forks source link

Not respecting 0 as idle timout as suggested by AWS lambda doc #48

Closed mokkabonna closed 2 years ago

mokkabonna commented 2 years ago

Sequelize uses lodash default to set default (respecting falsy if 0 set) while sequelize-pool does a simpler OR statement ||

https://github.com/sequelize/sequelize/blob/main/src/dialects/abstract/connection-manager.js#L34 https://github.com/sequelize/sequelize-pool/blob/master/src/Pool.ts#L167

The docs for using sequelize in AWS lambda https://sequelize.org/docs/v6/other-topics/aws-lambda/ context says to set it to 0, but that falls back to 30000ms since 0 is falsy.

Suggestion: use proper detection of undefined instead of simple or statement.

sushantdhiman commented 2 years ago

Hi @mokkabonna

Thanks for bringing this to my attention. I have marked this a bug. Can you submit a PR with tests?

sushantdhiman commented 2 years ago

This issue has been fixed by #50, now available as next major release sequelize-pool@8.0.0. This is a breaking change, because change in the default configuration could have un-intended side-effects.

You should submit a PR to main repository, let the current maintainers decide if this can be safely added to stable sequelize release.