aqhome-react: peridocally write vars.
This commit is contained in:
@@ -57,7 +57,7 @@
|
||||
#define FULL_DEBUG
|
||||
|
||||
#define AQHOME_REACT_READNET_INTERVAL 300
|
||||
|
||||
#define AQHOME_REACT_SAVE_INTERVAL 300
|
||||
|
||||
|
||||
/* ------------------------------------------------------------------------------------------------
|
||||
@@ -166,12 +166,14 @@ void _serve(AQHOME_REACT *aqh)
|
||||
time_t startTime;
|
||||
time_t lastTimerTime;
|
||||
time_t lastFileScanTime;
|
||||
time_t lastSaveTime;
|
||||
GWEN_DB_NODE *dbArgs;
|
||||
AQHREACT_UNIT *timerUnit;
|
||||
|
||||
startTime=time(NULL);
|
||||
lastTimerTime=startTime;
|
||||
lastFileScanTime=startTime;
|
||||
lastSaveTime=startTime;
|
||||
|
||||
AqHomeReact_SetLatestNetworkFileTime(aqh, AQHomeReact_GetNewestUnitNetFiletime());
|
||||
|
||||
@@ -216,6 +218,15 @@ void _serve(AQHOME_REACT *aqh)
|
||||
lastFileScanTime=now;
|
||||
}
|
||||
|
||||
if (now-lastSaveTime>AQHOME_REACT_SAVE_INTERVAL) {
|
||||
DBG_ERROR(NULL, "Writing var file");
|
||||
rv=AqHomeReact_WriteVarsFile(aqh);
|
||||
if (rv<0) {
|
||||
DBG_INFO(NULL, "Error writing runtime data");
|
||||
}
|
||||
lastSaveTime=time(NULL);
|
||||
}
|
||||
|
||||
if (timeout) {
|
||||
if ((now-startTime)>timeout) {
|
||||
DBG_ERROR(NULL, "Timeout, stopping service");
|
||||
|
||||
Reference in New Issue
Block a user