Vincit/tarn.js

feature request: asynchronous validate function

joseph349 opened this issue · 9 comments

I am using knex 0.15.2 along with tarn 1.1.4.
Have been getting the "This socket has been ended by the other party." recently when trying to use a connection that has been closed or redirected by the server.
We have found that we may be able to avoid this error by pinging the connection in the validation function.
Problem we're having is that the validation function is synchronous and there is no way for it to wait for the ping promise to resolve.
Can we have the validate function resolve async functions?

I thought it already was async, but looks like it is actually not. I'll fix this for the next release.

Is the work is already done? Is there a branch that we can use?

No. I just started to look into it. But it doesn't seem to be completely trivial to implement, so it might take some time.

This is actually pretty fundamental change and will need major release (strictly speaking it is not breaking change, but internal acquire behaviour changes significantly so better to do full release for this).

PR #45

Has this been published to npm?

not yet, I'll make a release when I have time

Looks like this feature has been shipped in v3.0 @ b577cfc

true