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