summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJürg Billeter <j@bitron.ch>2017-07-27 12:24:38 +0100
committerJürg Billeter <j@bitron.ch>2017-07-27 12:38:57 +0100
commit330615135053957b34a250ea919ecddeb67e82b3 (patch)
tree67255f28647ca66a328a44caa1697655ecc3ea82
parentbfd822b3232f69ed9df48a20fedf31be7e0986f1 (diff)
downloadbuildstream-330615135053957b34a250ea919ecddeb67e82b3.tar.gz
_artifactcache/pushreceive.py: Add handshake after sending objects
Ensure all objects have been sent before moving them into the repository and do not terminate pusher while receiver is still processing.
-rw-r--r--buildstream/_artifactcache/pushreceive.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/buildstream/_artifactcache/pushreceive.py b/buildstream/_artifactcache/pushreceive.py
index fd5b1d96d..3603e083d 100644
--- a/buildstream/_artifactcache/pushreceive.py
+++ b/buildstream/_artifactcache/pushreceive.py
@@ -496,6 +496,12 @@ class OSTreePusher(object):
# Send all the objects to receiver, checking status after each
self.writer.send_putobjects(self.repo, objects)
+ # Inform receiver that all objects have been sent
+ self.writer.send_done()
+
+ # Wait until receiver has completed
+ self.reader.receive_done()
+
return self.close()
@@ -562,6 +568,9 @@ class OSTreeReceiver(object):
# Receive the actual objects
received_objects = self.reader.receive_putobjects(self.repo)
+ # Ensure that pusher has sent all objects
+ self.reader.receive_done()
+
# If we didn't get any objects, we're done
if len(received_objects) == 0:
return 0
@@ -579,6 +588,9 @@ class OSTreeReceiver(object):
logging.debug('Setting ref {} to {}'.format(branch, revs[1]))
self.repo.set_ref_immediate(None, branch, revs[1], None)
+ # Inform pusher that everything is in place
+ self.writer.send_done()
+
return 0