Closed itai-sagi closed 5 years ago
So calling destroy two or more times on same resource cause pool to cross pool.max
limit?
not exactly.
because 2 errors are thrown when a connection is killed, the count is decreased by 2 for every connection that is killed, reducing the count
to zero and thus allowing more connections to be opened.
Then we should decrement count only when filter
removed something from _availableObjects
and _inUseObjects
. What do you think, I think that should fix this issue
Sounds good.
Can you update this PR and a test after this one. Just copy linked test and assert count is not decreased by more than one when destroy is called multiple times on same resource
Should be fixed by https://github.com/sequelize/sequelize-pool/pull/6, let me know if you got any suggestions :)
multiple calls to destroy will only result in its' side effects being called once. this is a fix for https://github.com/sequelize/sequelize/issues/10902