Fossil SCM

Add the test-backoffice-lease command for testing the backoffice.

drh 2018-08-08 00:01 trunk
Commit f26ef80609602e61dd912477b1a44101e999e219a314868503c52672fa21b9f2
1 file changed +40
--- src/backoffice.c
+++ src/backoffice.c
@@ -383,10 +383,50 @@
383383
fossil_print("ProcessId %lld: exists %d done %d\n",
384384
x, backofficeProcessExists(x),
385385
backofficeProcessDone(x));
386386
}
387387
}
388
+
389
+/*
390
+** COMMAND: test-backoffice-lease
391
+**
392
+** Usage: %fossil test-backoffice-lease
393
+**
394
+** Print out information about the backoffice "lease" entry in the
395
+** config table that controls whether or not backoffice should run.
396
+*/
397
+void test_backoffice_lease(void){
398
+ sqlite3_int64 tmNow = time(0);
399
+ Lease x;
400
+ const char *zLease;
401
+ db_find_and_open_repository(0,0);
402
+ verify_all_options();
403
+ zLease = db_get("backoffice","");
404
+ fossil_print("now: %lld\n", tmNow);
405
+ fossil_print("lease: \"%s\"\n", zLease);
406
+ backofficeReadLease(&x);
407
+ fossil_print("idCurrent: %-20lld", x.idCurrent);
408
+ if( backofficeProcessExists(x.idCurrent) ) fossil_print(" (exists)");
409
+ if( backofficeProcessDone(x.idCurrent) ) fossil_print(" (done)");
410
+ fossil_print("\n");
411
+ fossil_print("tmCurrent: %-20lld", x.tmCurrent);
412
+ if( x.tmCurrent>0 ){
413
+ fossil_print(" (now%+d)\n",x.tmCurrent-tmNow);
414
+ }else{
415
+ fossil_print("\n");
416
+ }
417
+ fossil_print("idNext: %-20lld", x.idNext);
418
+ if( backofficeProcessExists(x.idNext) ) fossil_print(" (exists)");
419
+ if( backofficeProcessDone(x.idNext) ) fossil_print(" (done)");
420
+ fossil_print("\n");
421
+ fossil_print("tmNext: %-20lld", x.tmNext);
422
+ if( x.tmNext>0 ){
423
+ fossil_print(" (now%+d)\n",x.tmNext-tmNow);
424
+ }else{
425
+ fossil_print("\n");
426
+ }
427
+}
388428
389429
/*
390430
** If backoffice processing is needed set the backofficeDb variable to the
391431
** name of the database file. If no backoffice processing is needed,
392432
** this routine makes no changes to state.
393433
--- src/backoffice.c
+++ src/backoffice.c
@@ -383,10 +383,50 @@
383 fossil_print("ProcessId %lld: exists %d done %d\n",
384 x, backofficeProcessExists(x),
385 backofficeProcessDone(x));
386 }
387 }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
388
389 /*
390 ** If backoffice processing is needed set the backofficeDb variable to the
391 ** name of the database file. If no backoffice processing is needed,
392 ** this routine makes no changes to state.
393
--- src/backoffice.c
+++ src/backoffice.c
@@ -383,10 +383,50 @@
383 fossil_print("ProcessId %lld: exists %d done %d\n",
384 x, backofficeProcessExists(x),
385 backofficeProcessDone(x));
386 }
387 }
388
389 /*
390 ** COMMAND: test-backoffice-lease
391 **
392 ** Usage: %fossil test-backoffice-lease
393 **
394 ** Print out information about the backoffice "lease" entry in the
395 ** config table that controls whether or not backoffice should run.
396 */
397 void test_backoffice_lease(void){
398 sqlite3_int64 tmNow = time(0);
399 Lease x;
400 const char *zLease;
401 db_find_and_open_repository(0,0);
402 verify_all_options();
403 zLease = db_get("backoffice","");
404 fossil_print("now: %lld\n", tmNow);
405 fossil_print("lease: \"%s\"\n", zLease);
406 backofficeReadLease(&x);
407 fossil_print("idCurrent: %-20lld", x.idCurrent);
408 if( backofficeProcessExists(x.idCurrent) ) fossil_print(" (exists)");
409 if( backofficeProcessDone(x.idCurrent) ) fossil_print(" (done)");
410 fossil_print("\n");
411 fossil_print("tmCurrent: %-20lld", x.tmCurrent);
412 if( x.tmCurrent>0 ){
413 fossil_print(" (now%+d)\n",x.tmCurrent-tmNow);
414 }else{
415 fossil_print("\n");
416 }
417 fossil_print("idNext: %-20lld", x.idNext);
418 if( backofficeProcessExists(x.idNext) ) fossil_print(" (exists)");
419 if( backofficeProcessDone(x.idNext) ) fossil_print(" (done)");
420 fossil_print("\n");
421 fossil_print("tmNext: %-20lld", x.tmNext);
422 if( x.tmNext>0 ){
423 fossil_print(" (now%+d)\n",x.tmNext-tmNow);
424 }else{
425 fossil_print("\n");
426 }
427 }
428
429 /*
430 ** If backoffice processing is needed set the backofficeDb variable to the
431 ** name of the database file. If no backoffice processing is needed,
432 ** this routine makes no changes to state.
433

Keyboard Shortcuts

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