Branch: Tag:

2022-09-15

2022-09-15 08:27:17 by Henrik Grubbström (Grubba) <grubba@grubba.org>

FSGC: Improved robustness of sleep at start of activity interval.

503:    sleep(60);    while(meta_fsgc_thread) {    int max_sleep = 300; -  int next_start = getvar("fsgc_starttime")->get_next(0); -  int next_stop = getvar("fsgc_stoptime")->get_next(0); +  int now = time(1); +  int next_start = getvar("fsgc_starttime")->get_next(now); +  int next_stop = getvar("fsgc_stoptime")->get_next(now);       if (next_start < 0) {    // FSGC Disabled
513:    // FSGC Not allowed to run now.    // Sleep until next start time, but max 5 minutes    // at a time in case the settings are changed. -  max_sleep = limit(0, next_start - time(1), max_sleep); +  max_sleep = limit(1, next_start - now, max_sleep);    } else {    // FSGC Allowed to run.    max_sleep = 60;