redmine

Added a "hold on" state (on "--standby-file" use)

... ... @@ -261,6 +261,7 @@ enum state_enum {
STATE_TERM,
STATE_THREAD_GC,
STATE_INITSYNC,
STATE_HOLDON,
STATE_UNKNOWN
};
typedef enum state_enum state_t;
... ...
... ... @@ -357,6 +357,7 @@ static char *const status_descr[] = {
[STATE_TERM] = "terminating",
[STATE_THREAD_GC] = "thread gc",
[STATE_INITSYNC] = "initsync",
[STATE_HOLDON] = "hold on",
NULL
};
... ...
... ... @@ -3002,11 +3002,21 @@ int sync_idle(ctx_t *ctx_p, indexes_t *indexes_p) {
// Checking if we can sync
if(ctx_p->flags[STANDBYFILE]) {
if (ctx_p->flags[STANDBYFILE]) {
struct stat st;
if(!stat(ctx_p->standbyfile, &st)) {
if (!stat(ctx_p->standbyfile, &st)) {
state_t state_old;
state_old = ctx_p->state;
ctx_p->state = STATE_HOLDON;
main_status_update(ctx_p);
debug(1, "Found standby file. Holding over syncs. Sleeping "XTOSTR(SLEEP_SECONDS)" second.");
sleep(SLEEP_SECONDS);
ctx_p->state = state_old;
main_status_update(ctx_p);
return 0;
}
}
... ...