Fossil SCM
Add the --reset option to the "fossil test-backoffice-lease" command.
Commit
b2e83470ea1f152147d55b659721e0ee41c8b828ce7e23f19769e99d1e0b3b06
Parent
366fda0c5110c9d…
1 file changed
+13
-1
+13
-1
| --- src/backoffice.c | ||
| +++ src/backoffice.c | ||
| @@ -364,20 +364,32 @@ | ||
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | /* |
| 367 | 367 | ** COMMAND: test-backoffice-lease |
| 368 | 368 | ** |
| 369 | -** Usage: %fossil test-backoffice-lease | |
| 369 | +** Usage: %fossil test-backoffice-lease ?--reset? | |
| 370 | 370 | ** |
| 371 | 371 | ** Print out information about the backoffice "lease" entry in the |
| 372 | 372 | ** config table that controls whether or not backoffice should run. |
| 373 | +** | |
| 374 | +** If the --reset option is given, the backoffice lease is reset. | |
| 375 | +** The use of the --reset option can be disruptive. It can cause two | |
| 376 | +** or more backoffice processes to be run simultaneously. Use it with | |
| 377 | +** caution. | |
| 373 | 378 | */ |
| 374 | 379 | void test_backoffice_lease(void){ |
| 375 | 380 | sqlite3_int64 tmNow = time(0); |
| 376 | 381 | Lease x; |
| 377 | 382 | const char *zLease; |
| 378 | 383 | db_find_and_open_repository(0,0); |
| 384 | + if( find_option("reset",0,0)!=0 ){ | |
| 385 | + db_unprotect(PROTECT_CONFIG); | |
| 386 | + db_multi_exec( | |
| 387 | + "DELETE FROM repository.config WHERE name='backoffice'" | |
| 388 | + ); | |
| 389 | + db_protect_pop(); | |
| 390 | + } | |
| 379 | 391 | verify_all_options(); |
| 380 | 392 | zLease = db_get("backoffice",""); |
| 381 | 393 | fossil_print("now: %lld\n", tmNow); |
| 382 | 394 | fossil_print("lease: \"%s\"\n", zLease); |
| 383 | 395 | backofficeReadLease(&x); |
| 384 | 396 |
| --- src/backoffice.c | |
| +++ src/backoffice.c | |
| @@ -364,20 +364,32 @@ | |
| 364 | } |
| 365 | |
| 366 | /* |
| 367 | ** COMMAND: test-backoffice-lease |
| 368 | ** |
| 369 | ** Usage: %fossil test-backoffice-lease |
| 370 | ** |
| 371 | ** Print out information about the backoffice "lease" entry in the |
| 372 | ** config table that controls whether or not backoffice should run. |
| 373 | */ |
| 374 | void test_backoffice_lease(void){ |
| 375 | sqlite3_int64 tmNow = time(0); |
| 376 | Lease x; |
| 377 | const char *zLease; |
| 378 | db_find_and_open_repository(0,0); |
| 379 | verify_all_options(); |
| 380 | zLease = db_get("backoffice",""); |
| 381 | fossil_print("now: %lld\n", tmNow); |
| 382 | fossil_print("lease: \"%s\"\n", zLease); |
| 383 | backofficeReadLease(&x); |
| 384 |
| --- src/backoffice.c | |
| +++ src/backoffice.c | |
| @@ -364,20 +364,32 @@ | |
| 364 | } |
| 365 | |
| 366 | /* |
| 367 | ** COMMAND: test-backoffice-lease |
| 368 | ** |
| 369 | ** Usage: %fossil test-backoffice-lease ?--reset? |
| 370 | ** |
| 371 | ** Print out information about the backoffice "lease" entry in the |
| 372 | ** config table that controls whether or not backoffice should run. |
| 373 | ** |
| 374 | ** If the --reset option is given, the backoffice lease is reset. |
| 375 | ** The use of the --reset option can be disruptive. It can cause two |
| 376 | ** or more backoffice processes to be run simultaneously. Use it with |
| 377 | ** caution. |
| 378 | */ |
| 379 | void test_backoffice_lease(void){ |
| 380 | sqlite3_int64 tmNow = time(0); |
| 381 | Lease x; |
| 382 | const char *zLease; |
| 383 | db_find_and_open_repository(0,0); |
| 384 | if( find_option("reset",0,0)!=0 ){ |
| 385 | db_unprotect(PROTECT_CONFIG); |
| 386 | db_multi_exec( |
| 387 | "DELETE FROM repository.config WHERE name='backoffice'" |
| 388 | ); |
| 389 | db_protect_pop(); |
| 390 | } |
| 391 | verify_all_options(); |
| 392 | zLease = db_get("backoffice",""); |
| 393 | fossil_print("now: %lld\n", tmNow); |
| 394 | fossil_print("lease: \"%s\"\n", zLease); |
| 395 | backofficeReadLease(&x); |
| 396 |