subsquid / squid-sdk

The main repo of the squid SDK
Apache License 2.0
1.23k stars 151 forks source link

Add `Promise.race` to avoid ROLLBACK query getting stuck #111

Closed ken-futureverse closed 2 years ago

ken-futureverse commented 2 years ago

Closes #109

ken-futureverse commented 2 years ago

any chance this and #110 get reviewed and merge?

eldargab commented 2 years ago

The point of ROLLBACK query is to keep the connection in a clean state. That doesn't happen when you time out rollback query like this PR suggests. You could omit rollback query entirely with the same effect.

As of why ROLLBACK hangs - this is a node-postgres issue which doesn't properly handle serialization errors and leaves the client state corrupted after those.

ken-futureverse commented 2 years ago

@eldargab I agreed, it's an issue on node-postgres, but don't you think it's better to throw and terminate the process if the ROLLBACK query takes a long time? Or perhaps a WARN so at least the dev knows what's going on?