Fossil

Check-in [4a544e5d]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Add the /test-backoffice-lease web page.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256:4a544e5dcb236b7d3fc391ce594339f567f39000b753fe73e822bc06603ca017
User & Date: drh 2018-08-08 14:23:56
Context
2018-08-08
14:40
Turn backoffice-nodelay on by default. check-in: af599d6a user: drh tags: trunk
14:23
Add the /test-backoffice-lease web page. check-in: 4a544e5d user: drh tags: trunk
14:08
Make sure the backoffice has all file descriptors closed before it starts. check-in: 15f85cfd user: drh tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/backoffice.c.

160
161
162
163
164
165
166








167
168
169
170
171
172
173
...
430
431
432
433
434
435
436





















































437
438
439
440
441
442
443
** never be a problem with waiting backoffice threads.  But in some cases
** a backoffice will delay a UI thread, so we don't want them to run for
** longer than needed.
*/
void backoffice_no_delay(void){
  backofficeNoDelay = 1;
}









/*
** Sleeps for the specified number of milliseconds -OR- until interrupted
** by another thread (if supported by the underlying platform).  Non-zero
** will be returned if the sleep was interrupted.
*/
static int backofficeSleep(int milliseconds){
................................................................................
  if( x.tmNext>0 ){
    fossil_print(" (now%+d)\n",x.tmNext-tmNow);
  }else{
    fossil_print("\n");
  }
}






















































/*
** If backoffice processing is needed set the backofficeDb variable to the
** name of the database file.  If no backoffice processing is needed,
** this routine makes no changes to state.
*/
void backoffice_check_if_needed(void){
  Lease x;







>
>
>
>
>
>
>
>







 







>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>







160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
...
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
** never be a problem with waiting backoffice threads.  But in some cases
** a backoffice will delay a UI thread, so we don't want them to run for
** longer than needed.
*/
void backoffice_no_delay(void){
  backofficeNoDelay = 1;
}

/*
** Signal that the backoffice should not be run at the conclusion of
** the current session.
*/
void backoffice_do_not_run(void){
  backofficeDb = "x";
}

/*
** Sleeps for the specified number of milliseconds -OR- until interrupted
** by another thread (if supported by the underlying platform).  Non-zero
** will be returned if the sleep was interrupted.
*/
static int backofficeSleep(int milliseconds){
................................................................................
  if( x.tmNext>0 ){
    fossil_print(" (now%+d)\n",x.tmNext-tmNow);
  }else{
    fossil_print("\n");
  }
}


/*
** WEBPAGE: test-backoffice-lease
**
** Print out information about the backoffice "lease" entry in the
** config table that controls whether or not backoffice should run.
*/
void test_backoffice_lease_page(void){
  sqlite3_int64 tmNow = time(0);
  Lease x;
  const char *zLease;
  login_check_credentials();
  if( !g.perm.Setup ){
    login_needed(0);
    return;
  }
  style_header("Backoffice Lease");
  backoffice_do_not_run();
  @ <table class='label-value'>
  zLease = db_get("backoffice","");
  @ <tr><th>Now:</th><td>%lld(tmNow)</td></tr>
  @ <tr><th>Lease:</th><td colspan="3">"%h(zLease)"</td></tr>
  backofficeReadLease(&x);
  @ <tr><th>idCurrent:</th><td>%lld(x.idCurrent)</td><td>&nbsp;</td><td>\
  if( backofficeProcessExists(x.idCurrent) ){
    @ (exists) \
  }
  if( backofficeProcessDone(x.idCurrent) ){
    @ (done) \
  }
  @ </td></tr>
  @ <tr><th>tmCurrent:</th><td>%lld(x.tmCurrent)</td><td></td><td>\
  if( x.tmCurrent>0 ){
    @ (now%+lld(x.tmCurrent-tmNow)) \
  }
  @ </td></tr>
  @ <tr><th>idNext:</th><td>%lld(x.idNext)</td><td>&nbsp;</td><td>\
  if( backofficeProcessExists(x.idNext) ){
    @ (exists) \
  }
  if( backofficeProcessDone(x.idNext) ){
    @ (done) \
  }
  @ </td></tr>
  @ <tr><th>tmNext:</th><td>%lld(x.tmNext)</td><td></td><td>\
  if( x.tmNext>0 ){
    @ (now%+lld(x.tmNext-tmNow)) \
  }
  @ </td></tr>
  @ </table>
  style_footer();
}

/*
** If backoffice processing is needed set the backofficeDb variable to the
** name of the database file.  If no backoffice processing is needed,
** this routine makes no changes to state.
*/
void backoffice_check_if_needed(void){
  Lease x;