Fix controller keeping stats for deleted streams - now deletes stats 2 minutes after receiving the last updates.
This commit is contained in:
parent
afefe24578
commit
a15ea64e4e
1 changed files with 10 additions and 0 deletions
|
@ -252,6 +252,15 @@ void startStream(std::string name, JSON::Value & data){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CheckStats(JSON::Value & stats){
|
||||||
|
unsigned int currTime = time(0);
|
||||||
|
for (JSON::ObjIter jit = stats.ObjBegin(); jit != stats.ObjEnd(); jit++){
|
||||||
|
if (currTime - lastBuffer[jit->first] > 120){
|
||||||
|
stats.removeMember(jit->first);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void CheckAllStreams(JSON::Value & data){
|
void CheckAllStreams(JSON::Value & data){
|
||||||
unsigned int currTime = time(0);
|
unsigned int currTime = time(0);
|
||||||
bool changed = false;
|
bool changed = false;
|
||||||
|
@ -355,6 +364,7 @@ int main(int argc, char ** argv){
|
||||||
processchecker = time(0);
|
processchecker = time(0);
|
||||||
Connector::CheckProtocols(Connector::Storage["config"]["protocols"]);
|
Connector::CheckProtocols(Connector::Storage["config"]["protocols"]);
|
||||||
Connector::CheckAllStreams(Connector::Storage["streams"]);
|
Connector::CheckAllStreams(Connector::Storage["streams"]);
|
||||||
|
Connector::CheckStats(Connector::Storage["statistics"]);
|
||||||
}
|
}
|
||||||
if (conf.getBool("uplink") && time(0) - lastuplink > UPLINK_INTERVAL){
|
if (conf.getBool("uplink") && time(0) - lastuplink > UPLINK_INTERVAL){
|
||||||
lastuplink = time(0);
|
lastuplink = time(0);
|
||||||
|
|
Loading…
Add table
Reference in a new issue