Fossil SCM
Fix the backoffice delay so that it extends the deadline for the follow-on process if the current process runs overtime. This prevents multiple follow-ons.
Commit
5542cd43b3fe305c41009ff4f6c1e6ddf3562cf00ecfb8a8959ae12ac21753d3
Parent
86b0a3d3f349264…
1 file changed
+13
-1
+13
-1
| --- src/backoffice.c | ||
| +++ src/backoffice.c | ||
| @@ -224,11 +224,11 @@ | ||
| 224 | 224 | break; |
| 225 | 225 | } |
| 226 | 226 | /* This process needs to queue up and wait for the current lease |
| 227 | 227 | ** to expire before continuing. */ |
| 228 | 228 | x.idNext = idSelf; |
| 229 | - x.tmNext = x.tmCurrent + BKOFCE_LEASE_TIME; | |
| 229 | + x.tmNext = (tmNow>x.tmCurrent ? tmNow : x.tmCurrent) + BKOFCE_LEASE_TIME; | |
| 230 | 230 | backofficeWriteLease(&x); |
| 231 | 231 | db_end_transaction(0); |
| 232 | 232 | if( x.tmCurrent >= tmNow ){ |
| 233 | 233 | sqlite3_sleep(1000*(x.tmCurrent - tmNow + 1)); |
| 234 | 234 | }else{ |
| @@ -249,5 +249,17 @@ | ||
| 249 | 249 | ** backoffice processing tasks, add them here. |
| 250 | 250 | */ |
| 251 | 251 | void backoffice_work(void){ |
| 252 | 252 | email_auto_exec(0); |
| 253 | 253 | } |
| 254 | + | |
| 255 | +/* | |
| 256 | +** COMMAND: test-backoffice | |
| 257 | +** | |
| 258 | +** Usage: test-backoffice | |
| 259 | +** | |
| 260 | +** Run backoffice processing | |
| 261 | +*/ | |
| 262 | +void test_backoffice_command(void){ | |
| 263 | + db_find_and_open_repository(0,0); | |
| 264 | + backoffice_run(); | |
| 265 | +} | |
| 254 | 266 |
| --- src/backoffice.c | |
| +++ src/backoffice.c | |
| @@ -224,11 +224,11 @@ | |
| 224 | break; |
| 225 | } |
| 226 | /* This process needs to queue up and wait for the current lease |
| 227 | ** to expire before continuing. */ |
| 228 | x.idNext = idSelf; |
| 229 | x.tmNext = x.tmCurrent + BKOFCE_LEASE_TIME; |
| 230 | backofficeWriteLease(&x); |
| 231 | db_end_transaction(0); |
| 232 | if( x.tmCurrent >= tmNow ){ |
| 233 | sqlite3_sleep(1000*(x.tmCurrent - tmNow + 1)); |
| 234 | }else{ |
| @@ -249,5 +249,17 @@ | |
| 249 | ** backoffice processing tasks, add them here. |
| 250 | */ |
| 251 | void backoffice_work(void){ |
| 252 | email_auto_exec(0); |
| 253 | } |
| 254 |
| --- src/backoffice.c | |
| +++ src/backoffice.c | |
| @@ -224,11 +224,11 @@ | |
| 224 | break; |
| 225 | } |
| 226 | /* This process needs to queue up and wait for the current lease |
| 227 | ** to expire before continuing. */ |
| 228 | x.idNext = idSelf; |
| 229 | x.tmNext = (tmNow>x.tmCurrent ? tmNow : x.tmCurrent) + BKOFCE_LEASE_TIME; |
| 230 | backofficeWriteLease(&x); |
| 231 | db_end_transaction(0); |
| 232 | if( x.tmCurrent >= tmNow ){ |
| 233 | sqlite3_sleep(1000*(x.tmCurrent - tmNow + 1)); |
| 234 | }else{ |
| @@ -249,5 +249,17 @@ | |
| 249 | ** backoffice processing tasks, add them here. |
| 250 | */ |
| 251 | void backoffice_work(void){ |
| 252 | email_auto_exec(0); |
| 253 | } |
| 254 | |
| 255 | /* |
| 256 | ** COMMAND: test-backoffice |
| 257 | ** |
| 258 | ** Usage: test-backoffice |
| 259 | ** |
| 260 | ** Run backoffice processing |
| 261 | */ |
| 262 | void test_backoffice_command(void){ |
| 263 | db_find_and_open_repository(0,0); |
| 264 | backoffice_run(); |
| 265 | } |
| 266 |