Fossil SCM

Add the --reset option to the "fossil test-backoffice-lease" command.

drh 2021-03-18 22:09 trunk
Commit b2e83470ea1f152147d55b659721e0ee41c8b828ce7e23f19769e99d1e0b3b06
1 file changed +13 -1
+13 -1
--- src/backoffice.c
+++ src/backoffice.c
@@ -364,20 +364,32 @@
364364
}
365365
366366
/*
367367
** COMMAND: test-backoffice-lease
368368
**
369
-** Usage: %fossil test-backoffice-lease
369
+** Usage: %fossil test-backoffice-lease ?--reset?
370370
**
371371
** Print out information about the backoffice "lease" entry in the
372372
** 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.
373378
*/
374379
void test_backoffice_lease(void){
375380
sqlite3_int64 tmNow = time(0);
376381
Lease x;
377382
const char *zLease;
378383
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
+ }
379391
verify_all_options();
380392
zLease = db_get("backoffice","");
381393
fossil_print("now: %lld\n", tmNow);
382394
fossil_print("lease: \"%s\"\n", zLease);
383395
backofficeReadLease(&x);
384396
--- 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

Keyboard Shortcuts

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