Mercurial > hg > orthanc-databases
diff Framework/PostgreSQL/PostgreSQLDatabase.cpp @ 418:a7f0f27fe33c pg-transactions
wip: advisory lock around CreateInstance: not ok see WO-139
author | Alain Mazy <am@osimis.io> |
---|---|
date | Tue, 27 Jun 2023 15:17:39 +0200 |
parents | 3d6886f3e5b3 |
children | dbf811b1bb43 |
line wrap: on
line diff
--- a/Framework/PostgreSQL/PostgreSQLDatabase.cpp Fri Jun 23 14:26:58 2023 +0200 +++ b/Framework/PostgreSQL/PostgreSQLDatabase.cpp Tue Jun 27 15:17:39 2023 +0200 @@ -318,13 +318,15 @@ PostgreSQLDatabase::TransientAdvisoryLock::TransientAdvisoryLock( PostgreSQLDatabase& database, - int32_t lock) : + int32_t lock, + unsigned int retries, + unsigned int retryInterval) : database_(database), lock_(lock) { bool locked = true; - for (unsigned int i = 0; i < 10; i++) + for (unsigned int i = 0; i < retries; i++) { if (database_.AcquireAdvisoryLock(lock_)) { @@ -333,7 +335,7 @@ } else { - boost::this_thread::sleep(boost::posix_time::milliseconds(500)); + boost::this_thread::sleep(boost::posix_time::milliseconds(retryInterval)); } }