Call Goal as in catch/3. If a deadlock ('40001') error occurs then Goal is called again immediately if another transaction has completed in the
time since Goal was called, since that transaction may well have been the reason for the deadlock.
If no other transaction has completed Goal is called again after a random delay of 0.0 to 2.0 seconds. The maximum number of retries
is specified by maximum_deadlock_retries/1. It is important to note that the deadlock mechanism actually retries Goal, i.e. it calls it
Use this only when you are sure Goal has no non-database side effects (assert/retract, file operations etc)
Originally developed for use inside cql_transaction/3, resolve_deadlock/1 can also be used to ensure non-transactional
operations can resolve deadlocks.