From 18feed9f91cc816eac670351c71a930fd13ec211 Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 5 Mar 2006 20:30:45 +0000 Subject: [PATCH] Remove old filenames at the start. git-svn-id: file:///home/phd/archive/SVN/xsetbg/trunk@8 143022c7-580b-0410-bae3-87f2bf5d3141 --- xsetbg.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/xsetbg.py b/xsetbg.py index 93791a4..865a5ee 100755 --- a/xsetbg.py +++ b/xsetbg.py @@ -123,7 +123,18 @@ except anydbm.error, msg: os.remove(global_db_name) global_db = shelve.open(global_db_name, flag='c') -global_db.close() # Close DB in parent process +# Remove old filenames +old_time = time() - min_delay + +to_delete = [] +for key in global_db.keys(): + if key.startswith('/') and global_db[key] < old_time: + to_delete.append(key) + +for key in to_delete: + del global_db[key] + +global_db.close() # Close DB in the parent process # DB keys -- 2.39.5