diff options
author | Jürg Billeter <j@bitron.ch> | 2019-07-24 10:51:22 +0200 |
---|---|---|
committer | Jürg Billeter <j@bitron.ch> | 2019-08-20 08:09:52 +0200 |
commit | 9ff6a38786726c4e800ec523714ea442dfb2c605 (patch) | |
tree | 98354d69cd60d569abed4a2d2dc468f59f95f9f3 | |
parent | ca23e62e59bc91f38f53cd9010d82480e22e0565 (diff) | |
download | buildstream-9ff6a38786726c4e800ec523714ea442dfb2c605.tar.gz |
casserver.py: Update mtime on read
-rw-r--r-- | src/buildstream/_cas/casserver.py | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/buildstream/_cas/casserver.py b/src/buildstream/_cas/casserver.py index 6da83d364..ba1b65c7c 100644 --- a/src/buildstream/_cas/casserver.py +++ b/src/buildstream/_cas/casserver.py @@ -190,6 +190,8 @@ class _ByteStreamServicer(bytestream_pb2_grpc.ByteStreamServicer): context.set_code(grpc.StatusCode.NOT_FOUND) return + os.utime(f.fileno()) + if request.read_offset > 0: f.seek(request.read_offset) @@ -306,11 +308,14 @@ class _ContentAddressableStorageServicer(remote_execution_pb2_grpc.ContentAddres blob_response.digest.hash = digest.hash blob_response.digest.size_bytes = digest.size_bytes try: - with open(self.cas.objpath(digest), 'rb') as f: + objpath = self.cas.objpath(digest) + with open(objpath, 'rb') as f: if os.fstat(f.fileno()).st_size != digest.size_bytes: blob_response.status.code = code_pb2.NOT_FOUND continue + os.utime(f.fileno()) + blob_response.data = f.read(digest.size_bytes) except FileNotFoundError: blob_response.status.code = code_pb2.NOT_FOUND |