summaryrefslogtreecommitdiffstats
path: root/combox
diff options
context:
space:
mode:
authorSiddharth Ravikumar <sravik@bgsu.edu>2015-09-12 22:04:15 -0400
committerSiddharth Ravikumar <sravik@bgsu.edu>2015-09-12 22:04:15 -0400
commit9d14db03da5d10d5ab0d7cc76b20e7b1ed5523bf (patch)
tree2722432416d9d6f275d062d2b5301ee17688a39b /combox
parentf1a828b2ae28f6ced224d8055bd52c053bd70b38 (diff)
fix for bug #6
Now, we check if the directory contains files, if it does, then we delay the deletion of the directory.
Diffstat (limited to 'combox')
-rw-r--r--combox/events.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/combox/events.py b/combox/events.py
index d2a2b70..f83e351 100644
--- a/combox/events.py
+++ b/combox/events.py
@@ -521,8 +521,17 @@ class NodeDirMonitor(LoggingEventHandler):
if num == self.num_nodes:
# Delete corresponding directory under the combox
# directory.
- rm_path(file_cb_path)
- self.silo.node_rem('file_deleted', file_cb_path)
+ if os.listdir(file_cb_path):
+ # There are files under this directory that
+ # are not deleted yet, so we got to delay
+ # deletion :|
+ print "Marking", file_cb_path, "for later deletion."
+ delayed_thread = Timer(15, self.delete_later,
+ [file_cb_path])
+ delayed_thread.start()
+ else:
+ rm_path(file_cb_path)
+ self.silo.node_rem('file_deleted', file_cb_path)
elif not event.is_directory and path.exists(file_cb_path):
print event.src_path, "must have been deleted on another computer."
with self.lock: