]> git.ipfire.org Git - people/jschlag/pbs.git/blobdiff - src/buildservice/__init__.py
Allow deleting files after a certain time from the filesystem
[people/jschlag/pbs.git] / src / buildservice / __init__.py
index 36c7c0de9ace3a4dc537ba6eebd1a7cfa7764a48..f7035005bd9948bc63c53c60d9ad85fddbe4e725 100644 (file)
@@ -128,8 +128,13 @@ class Backend(object):
 
                return database.Connection(hostname, name, user=user, password=password)
 
+       def delete_file(self, path, not_before=None):
+               self.db.execute("INSERT INTO queue_delete(path, not_before) \
+                       VALUES(%s, %s)", path, not_before)
+
        def cleanup_files(self):
-               query = self.db.query("SELECT * FROM queue_delete")
+               query = self.db.query("SELECT * FROM queue_delete \
+                       WHERE (not_before IS NULL OR not_before >= NOW())")
 
                for row in query:
                        if not row.path: