Deleting expired timers is now triggered immediately after the timers are modified

This commit is contained in:
Klaus Schmidinger 2021-04-20 13:22:37 +02:00
parent 02c668a6a9
commit ce23ba64bd
4 changed files with 11 additions and 8 deletions

View File

@ -9641,7 +9641,7 @@ Video Disk Recorder Revision History
- No longer switching devices for pattern timers (thanks to Helmut Binder).
- cTimer::TriggerRespawn() now only acts on local timers.
2021-04-19:
2021-04-20:
- When spawning pattern timers, the new function cTimers::GetTimerForEvent() is now used
to check whether a matching event already has a local spawned timer. Reason: creating a timer
@ -9661,3 +9661,4 @@ Video Disk Recorder Revision History
- The new functions cTimer::Start/StopTimeEvent() are now used in the LCARS skin to display
the start/stop times of timers in the main menu.
- EXPIRELATENCY now only applies to VPS timers.
- Deleting expired timers is now triggered immediately after the timers are modified.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: timers.c 5.15 2021/04/20 09:50:02 kls Exp $
* $Id: timers.c 5.16 2021/04/20 13:22:37 kls Exp $
*/
#include "timers.h"
@ -1238,9 +1238,11 @@ bool cTimers::AdjustSpawnedTimers(void)
return TimersModified;
}
bool cTimers::DeleteExpired(void)
#define DELETE_EXPIRED_TIMEOUT 30 // seconds
bool cTimers::DeleteExpired(bool Force)
{
if (time(NULL) - lastDeleteExpired < 30)
if (!Force && time(NULL) - lastDeleteExpired < DELETE_EXPIRED_TIMEOUT)
return false;
bool TimersModified = false;
cTimer *ti = First();

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: timers.h 5.7 2021/04/18 14:56:40 kls Exp $
* $Id: timers.h 5.8 2021/04/20 13:22:37 kls Exp $
*/
#ifndef __TIMERS_H
@ -203,7 +203,7 @@ public:
bool SetEvents(const cSchedules *Schedules);
bool SpawnPatternTimers(const cSchedules *Schedules);
bool AdjustSpawnedTimers(void);
bool DeleteExpired(void);
bool DeleteExpired(bool Force);
void Add(cTimer *Timer, cTimer *After = NULL);
void Ins(cTimer *Timer, cTimer *Before = NULL);
void Del(cTimer *Timer, bool DeleteObject = true);

4
vdr.c
View File

@ -22,7 +22,7 @@
*
* The project's page is at http://www.tvdr.de
*
* $Id: vdr.c 5.4 2021/04/10 11:32:50 kls Exp $
* $Id: vdr.c 5.5 2021/04/20 13:22:37 kls Exp $
*/
#include <getopt.h>
@ -1188,7 +1188,7 @@ int main(int argc, char *argv[])
LastTimerCheck = Now;
}
// Delete expired timers:
if (Timers->DeleteExpired())
if (Timers->DeleteExpired(TimersModified))
TimersModified = true;
// Make sure there is enough free disk space for ongoing recordings:
int MaxPriority = Timers->GetMaxPriority();