Skip to content

pg_connect_pool retry on cancelled queries or dropped connection #691

Answered by sm-shaw
eqbalz asked this question in Q&A
Discussion options

You must be logged in to vote

There is already the ability to re-run the entire script using the Virtual User Iterations option:

This can then be used to reconnect after a failure. An example is shown here using SQL Server, however the approach can be used for any database.

Firstly make sure that RAISEERROR is set to true so that errors caused the driver script to exit.

Then at the start of the script, if needed, add a catch to close any connections from the previous iteration, in this case we have added obdc close to the start of the script.

Note that also in a scenario where the system may be down for a period of time you may want to add a pause before trying to connect by also adding a line such as the following…

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@eqbalz
Comment options

@sm-shaw
Comment options

@eqbalz
Comment options

@sm-shaw
Comment options

Answer selected by sm-shaw
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants