Fossil SCM

Add the lock-timeout setting.

drh 2019-09-12 07:31 trunk
Commit 6d3daf74e385072cdf1dcf748e709faeefb632cb63c6fb707e05ec3593f326bd
2 files changed +18 +2 -2
+18
--- src/db.c
+++ src/db.c
@@ -3374,10 +3374,28 @@
33743374
** to leave "localauth" set to 0 in most installations, and
33753375
** especially on cloned repositories on workstations. Leaving
33763376
** "localauth" at 0 makes the "fossil ui" command more convenient
33773377
** to use.
33783378
*/
3379
+/*
3380
+** SETTING: lock-timeout width=25 default=86400
3381
+** This is the number of seconds that a check-in lock will be held on
3382
+** the server before the lock expires. The default is a 24-hour delay.
3383
+** Set this value to zero to disable the check-in lock mechanism.
3384
+**
3385
+** This value should be set on the server to which users auto-sync
3386
+** their work. This setting has no affect on client repositories. The
3387
+** check-in lock mechanism is only effective if all users are auto-syncing
3388
+** to the same server.
3389
+**
3390
+** Check-in locks are an advisory mechanism designed to help prevent
3391
+** accidental forks due to a check-in race in installations where many
3392
+** user are committing to the same branch and auto-sync is enabled.
3393
+** As forks are harmless, there is no harm in disabling this mechanism.
3394
+** However, keeping check-in locks turned on can help prevent unnecessary
3395
+** confusion.
3396
+*/
33793397
/*
33803398
** SETTING: main-branch width=40 default=trunk
33813399
** The value is the primary branch for the project.
33823400
*/
33833401
/*
33843402
--- src/db.c
+++ src/db.c
@@ -3374,10 +3374,28 @@
3374 ** to leave "localauth" set to 0 in most installations, and
3375 ** especially on cloned repositories on workstations. Leaving
3376 ** "localauth" at 0 makes the "fossil ui" command more convenient
3377 ** to use.
3378 */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3379 /*
3380 ** SETTING: main-branch width=40 default=trunk
3381 ** The value is the primary branch for the project.
3382 */
3383 /*
3384
--- src/db.c
+++ src/db.c
@@ -3374,10 +3374,28 @@
3374 ** to leave "localauth" set to 0 in most installations, and
3375 ** especially on cloned repositories on workstations. Leaving
3376 ** "localauth" at 0 makes the "fossil ui" command more convenient
3377 ** to use.
3378 */
3379 /*
3380 ** SETTING: lock-timeout width=25 default=86400
3381 ** This is the number of seconds that a check-in lock will be held on
3382 ** the server before the lock expires. The default is a 24-hour delay.
3383 ** Set this value to zero to disable the check-in lock mechanism.
3384 **
3385 ** This value should be set on the server to which users auto-sync
3386 ** their work. This setting has no affect on client repositories. The
3387 ** check-in lock mechanism is only effective if all users are auto-syncing
3388 ** to the same server.
3389 **
3390 ** Check-in locks are an advisory mechanism designed to help prevent
3391 ** accidental forks due to a check-in race in installations where many
3392 ** user are committing to the same branch and auto-sync is enabled.
3393 ** As forks are harmless, there is no harm in disabling this mechanism.
3394 ** However, keeping check-in locks turned on can help prevent unnecessary
3395 ** confusion.
3396 */
3397 /*
3398 ** SETTING: main-branch width=40 default=trunk
3399 ** The value is the primary branch for the project.
3400 */
3401 /*
3402
+2 -2
--- src/xfer.c
+++ src/xfer.c
@@ -1559,11 +1559,11 @@
15591559
&& xfer.nToken==4
15601560
&& blob_is_hname(&xfer.aToken[2])
15611561
){
15621562
Stmt q;
15631563
sqlite3_int64 iNow = time(0);
1564
- const sqlite3_int64 maxAge = 3600*24; /* Locks expire after 24 hours */
1564
+ sqlite3_int64 maxAge = db_get_int("lock-timeout",3600*24);
15651565
int seenFault = 0;
15661566
db_prepare(&q,
15671567
"SELECT json_extract(value,'$.login'),"
15681568
" mtime,"
15691569
" json_extract(value,'$.clientid'),"
@@ -1572,11 +1572,11 @@
15721572
" FROM config WHERE name GLOB 'ci-lock-*'"
15731573
);
15741574
while( db_step(&q)==SQLITE_ROW ){
15751575
int x = db_column_int(&q,3);
15761576
const char *zName = db_column_text(&q,4);
1577
- if( db_column_int64(&q,1)<iNow-maxAge || !is_a_leaf(x) ){
1577
+ if( db_column_int64(&q,1)<=iNow-maxAge || !is_a_leaf(x) ){
15781578
/* check-in locks expire after maxAge seconds, or when the
15791579
** check-in is no longer a leaf */
15801580
db_multi_exec("DELETE FROM config WHERE name=%Q", zName);
15811581
continue;
15821582
}
15831583
--- src/xfer.c
+++ src/xfer.c
@@ -1559,11 +1559,11 @@
1559 && xfer.nToken==4
1560 && blob_is_hname(&xfer.aToken[2])
1561 ){
1562 Stmt q;
1563 sqlite3_int64 iNow = time(0);
1564 const sqlite3_int64 maxAge = 3600*24; /* Locks expire after 24 hours */
1565 int seenFault = 0;
1566 db_prepare(&q,
1567 "SELECT json_extract(value,'$.login'),"
1568 " mtime,"
1569 " json_extract(value,'$.clientid'),"
@@ -1572,11 +1572,11 @@
1572 " FROM config WHERE name GLOB 'ci-lock-*'"
1573 );
1574 while( db_step(&q)==SQLITE_ROW ){
1575 int x = db_column_int(&q,3);
1576 const char *zName = db_column_text(&q,4);
1577 if( db_column_int64(&q,1)<iNow-maxAge || !is_a_leaf(x) ){
1578 /* check-in locks expire after maxAge seconds, or when the
1579 ** check-in is no longer a leaf */
1580 db_multi_exec("DELETE FROM config WHERE name=%Q", zName);
1581 continue;
1582 }
1583
--- src/xfer.c
+++ src/xfer.c
@@ -1559,11 +1559,11 @@
1559 && xfer.nToken==4
1560 && blob_is_hname(&xfer.aToken[2])
1561 ){
1562 Stmt q;
1563 sqlite3_int64 iNow = time(0);
1564 sqlite3_int64 maxAge = db_get_int("lock-timeout",3600*24);
1565 int seenFault = 0;
1566 db_prepare(&q,
1567 "SELECT json_extract(value,'$.login'),"
1568 " mtime,"
1569 " json_extract(value,'$.clientid'),"
@@ -1572,11 +1572,11 @@
1572 " FROM config WHERE name GLOB 'ci-lock-*'"
1573 );
1574 while( db_step(&q)==SQLITE_ROW ){
1575 int x = db_column_int(&q,3);
1576 const char *zName = db_column_text(&q,4);
1577 if( db_column_int64(&q,1)<=iNow-maxAge || !is_a_leaf(x) ){
1578 /* check-in locks expire after maxAge seconds, or when the
1579 ** check-in is no longer a leaf */
1580 db_multi_exec("DELETE FROM config WHERE name=%Q", zName);
1581 continue;
1582 }
1583

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button