diff options
author | Siddharth Ravikumar <sravik@bgsu.edu> | 2015-04-08 20:49:09 -0400 |
---|---|---|
committer | Siddharth Ravikumar <sravik@bgsu.edu> | 2015-04-08 20:49:09 -0400 |
commit | a6a2c35dbdcae1a1a69e348d8fc2ffe07eee4be3 (patch) | |
tree | 2a3183d20e48952b2b3cf11ee76cd160745ef352 /combox | |
parent | f15ce63ba11ad101349ee51a0baa4109400d7329 (diff) |
rewrote combox.events.NodeDirMonitor.on_modified method.
- Now the the node monitor waits for all shards of the file,
which was modified on a remote computer, to arrive on this
computer, before it re-constructs the file into the respective
location in the combox directory.
- Tests for it is at
tests.events_test.TestEvents.test_NDM_onmodified method.
modified: combox/events.py
modified: tests/events_test.py
Part of this was done while listening to Avril's "Complicated" ; I
think this is the only modern Pop song which I like.
Diffstat (limited to 'combox')
-rw-r--r-- | combox/events.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/combox/events.py b/combox/events.py index 609ed8e..bc6fe8b 100644 --- a/combox/events.py +++ b/combox/events.py @@ -373,6 +373,11 @@ class NodeDirMonitor(LoggingEventHandler): # means, file was modified on another computer (also # running combox). so, reconstruct the file and put it # in the combox directory. - decrypt_and_glue(file_cb_path, self.config) - # update db. - self.silo.update(file_cb_path) + with self.lock: + self.silo.node_set('file_modified', file_cb_path) + num = self.silo.node_get('file_modified', file_cb_path) + if num == self.num_nodes: + decrypt_and_glue(file_cb_path, self.config) + # update db. + self.silo.update(file_cb_path) + self.silo.node_rem('file_modified', file_cb_path) |