Fossil

Check-in [b6aadace]
Login

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

Overview
Comment:Remove the /test-backoffice-lease webpage, since it doesn't really work correctly. Use only the "fossil test-backoffice-lease" command moving forward. We can wrap that command in a Wapp script if necessary.
Downloads: Tarball | ZIP archive
Timelines: family | ancestors | descendants | both | backoffice-full-close
Files: files | file ages | folders
SHA3-256: b6aadace396e54c6370c6eaae56eda275049bdad87af5705da0f0413df38df25
User & Date: drh 2018-08-08 18:15:27.166
Context
2018-08-08
18:17
Fix the backoffice processes on unix so that they close file descriptors 0, 1, and 2 and reopen them on /dev/null, so as not to interfere with parent processes in any way. Restore the default of backoffice-nodelay back to off. Remove the /test-backoffice-lease webpage, which did not work correctly. ... (check-in: c09b2512 user: drh tags: trunk)
18:15
Remove the /test-backoffice-lease webpage, since it doesn't really work correctly. Use only the "fossil test-backoffice-lease" command moving forward. We can wrap that command in a Wapp script if necessary. ... (Closed-Leaf check-in: b6aadace user: drh tags: backoffice-full-close)
18:13
Set the default backoffice-nodelay back to off. ... (check-in: 353a4e12 user: drh tags: backoffice-full-close)
Changes
Unified Diff Ignore Whitespace Patch
Changes to src/backoffice.c.
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
** 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 defined(_WIN32)







<
<
<
<
<
<
<
<







162
163
164
165
166
167
168








169
170
171
172
173
174
175
** 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 defined(_WIN32)
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
505
506
507
508
509
510
511
512
513
514
515
516
517
518
  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>
#ifndef _WIN32
  if( P("fds")!=0 ){
    int i;
    @ <tr><th>open fds:</th><td colspan="3">
    for(i=0; i<1000; i++){
      int rc = fcntl(i, F_GETFL, 0);
      if( rc<0 ) continue;
      @ %d(i) \
    }
    @ </td></tr>
  }
#endif

  @ </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;







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







431
432
433
434
435
436
437


































































438
439
440
441
442
443
444
  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;