Fossil SCM
Add the lock-timeout setting.
Commit
6d3daf74e385072cdf1dcf748e709faeefb632cb63c6fb707e05ec3593f326bd
Parent
72a4b613479ad77…
2 files changed
+18
+2
-2
M
src/db.c
+18
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -3374,10 +3374,28 @@ | ||
| 3374 | 3374 | ** to leave "localauth" set to 0 in most installations, and |
| 3375 | 3375 | ** especially on cloned repositories on workstations. Leaving |
| 3376 | 3376 | ** "localauth" at 0 makes the "fossil ui" command more convenient |
| 3377 | 3377 | ** to use. |
| 3378 | 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 | +*/ | |
| 3379 | 3397 | /* |
| 3380 | 3398 | ** SETTING: main-branch width=40 default=trunk |
| 3381 | 3399 | ** The value is the primary branch for the project. |
| 3382 | 3400 | */ |
| 3383 | 3401 | /* |
| 3384 | 3402 |
| --- 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 @@ | ||
| 1559 | 1559 | && xfer.nToken==4 |
| 1560 | 1560 | && blob_is_hname(&xfer.aToken[2]) |
| 1561 | 1561 | ){ |
| 1562 | 1562 | Stmt q; |
| 1563 | 1563 | 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); | |
| 1565 | 1565 | int seenFault = 0; |
| 1566 | 1566 | db_prepare(&q, |
| 1567 | 1567 | "SELECT json_extract(value,'$.login')," |
| 1568 | 1568 | " mtime," |
| 1569 | 1569 | " json_extract(value,'$.clientid')," |
| @@ -1572,11 +1572,11 @@ | ||
| 1572 | 1572 | " FROM config WHERE name GLOB 'ci-lock-*'" |
| 1573 | 1573 | ); |
| 1574 | 1574 | while( db_step(&q)==SQLITE_ROW ){ |
| 1575 | 1575 | int x = db_column_int(&q,3); |
| 1576 | 1576 | 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) ){ | |
| 1578 | 1578 | /* check-in locks expire after maxAge seconds, or when the |
| 1579 | 1579 | ** check-in is no longer a leaf */ |
| 1580 | 1580 | db_multi_exec("DELETE FROM config WHERE name=%Q", zName); |
| 1581 | 1581 | continue; |
| 1582 | 1582 | } |
| 1583 | 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 | 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 |