summaryrefslogtreecommitdiffstats
path: root/combox/events.py
diff options
context:
space:
mode:
authorSiddharth Ravikumar <sravik@bgsu.edu>2015-03-13 12:48:48 -0400
committerSiddharth Ravikumar <sravik@bgsu.edu>2015-03-13 12:48:48 -0400
commitf024a16d6f689d2ad4ed3420b58e78ffe88e94ae (patch)
tree9feb9771d228bba3cf6036b26fbd35c9456ef59a /combox/events.py
parent1f91f748cb2ff193011aaab714442298a231aa10 (diff)
updated on_created, on_modified, on_deleted methods in NodeDirMonitor.
Now they check if the event.src_path is a shard or a directory before doing anything. modified: combox/events.py
Diffstat (limited to 'combox/events.py')
-rw-r--r--combox/events.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/combox/events.py b/combox/events.py
index 973a79d..5cdd54f 100644
--- a/combox/events.py
+++ b/combox/events.py
@@ -240,6 +240,11 @@ class NodeDirMonitor(LoggingEventHandler):
super(NodeDirMonitor, self).on_created(event)
self.silo_update()
+ if not self.shardp(event.src_path) and not event.is_directory:
+ # the file created can be ignored as it is not a shard or
+ # a directory.
+ return
+
file_cb_path = cb_path(event.src_path, self.config)
if event.is_directory and (not path.exists(file_cb_path)):
@@ -262,6 +267,11 @@ class NodeDirMonitor(LoggingEventHandler):
super(NodeDirMonitor, self).on_deleted(event)
self.silo_update()
+ if not self.shardp(event.src_path) and not event.is_directory:
+ # the file created can be ignored as it is not a shard or
+ # a directory.
+ return
+
file_cb_path = cb_path(event.src_path, self.config)
if event.is_directory:
@@ -278,6 +288,11 @@ class NodeDirMonitor(LoggingEventHandler):
super(NodeDirMonitor, self).on_modified(event)
self.silo_update()
+ if not self.shardp(event.src_path) and not event.is_directory:
+ # the file created can be ignored as it is not a shard or
+ # a directory.
+ return
+
file_cb_path = cb_path(event.src_path, self.config)
if event.is_directory: