Revision
100217
Author
cal@macports.org
Date
2012-12-03 16:12:26 -0800 (Mon, 03 Dec 2012)

Log Message

registry: use sqlite3_busy_timeout

This caps CPU usage of MacPorts processes waiting for the registry
database while it is exclusively locked at about 1.5%. This could be
further reduced by using a busy handler and adjusting the timeout
depending on the number of calls to the busy handler.

Modified Paths

Diff

Modified: trunk/base/src/cregistry/registry.c (100216 => 100217)


--- trunk/base/src/cregistry/registry.c	2012-12-03 23:43:54 UTC (rev 100216)
+++ trunk/base/src/cregistry/registry.c	2012-12-04 00:12:26 UTC (rev 100217)
@@ -118,6 +118,8 @@
         sqlite3_extended_result_codes(reg->db, 1);
 #endif
 
+        sqlite3_busy_timeout(reg->db, 25);
+
         if (init_db(reg->db, errPtr)) {
             reg->status = reg_none;
             *regPtr = reg;