Cleanup Thread (like .update)

Message ID 4DB44359D0%linux@youmustbejoking.demon.co.uk
State New
Headers

Commit Message

Darren Salt Oct. 3, 2005, 10:39 p.m. UTC
  I demand that Klaus Schmidinger may or may not have written...

> hgm.bg wrote:
>> Is there a possibility to implement the same way .update works a way to
>> start the cleanup thread which is deleting the deleted recordings ? I'm
>> usually low an diskspace and when try to free space for new recordings it
>> takes mostly more than 5 minutes of an idle VDR to delete the recordings
>> on the system. Sometimes 5 minutes is too long :) [...]

I find that it often takes too long too...

> recording.c:

> #define REMOVECHECKDELTA 3600 // seconds between checks for removing deleted files

Experimental patch (compile-tested only) attached. It adjusts the removal
check scheduling so that removal occurs at (by default) 6 minutes after
deletion. There is a 1-minute minimum delay, and the delay is reset every
time a recording is marked for deletion.

This also gives you enough time to unmark a recording, either by renaming it
manually or by using an undelete plugin.
  

Comments

HGM.bg \(GMX\) Oct. 5, 2005, 10:33 a.m. UTC | #1
vdr-bounces@linuxtv.org wrote:

>> #define REMOVECHECKDELTA 3600 // seconds between checks for removing
>> deleted files
> 
> Experimental patch (compile-tested only) attached. It adjusts the
> removal check scheduling so that removal occurs at (by default) 6
> minutes after deletion. There is a 1-minute minimum delay, and the
> delay is reset every time a recording is marked for deletion.   
> 
> This also gives you enough time to unmark a recording, either by
> renaming it manually or by using an undelete plugin. 

Okay, i will try this, thx

/hgm.bg
  

Patch

--- vdr-1.3.34/recording.c~
+++ vdr-1.3.34/recording.c
@@ -61,10 +61,10 @@ 
 bool VfatFileSystem = false;
 
 static cRecordings DeletedRecordings(true);
+static time_t LastRemoveCheck = 0;
 
 void RemoveDeletedRecordings(void)
 {
-  static time_t LastRemoveCheck = 0;
   if (LastRemoveCheck == 0) {
      DeletedRecordings.Update();
      LastRemoveCheck = time(NULL) - REMOVECHECKDELTA * 9 / 10;
@@ -718,6 +718,7 @@ 
         }
      isyslog("deleting recording %s", FileName());
      result = RenameVideoFile(FileName(), NewName);
+     LastRemoveCheck = time(NULL) - max (60, REMOVECHECKDELTA * 9 / 10);
      }
   free(NewName);
   return result;