1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-28 19:01:58 +00:00

RemoteRepository: Always store chunk ids in cache instead of rpc argument encoding of get request.

This commit is contained in:
Martin Hostettler 2016-08-05 21:48:23 +02:00
parent e9605d67ad
commit 2608a5620a

View file

@ -425,20 +425,21 @@ def handle_error(error, res):
if calls:
if is_preloaded:
assert cmd == "get", "is_preload is only supported for 'get'"
if calls[0] in self.cache:
waiting_for.append(fetch_from_cache(calls.pop(0)))
if calls[0][0] in self.cache:
waiting_for.append(fetch_from_cache(calls.pop(0)[0]))
else:
args = calls.pop(0)
if cmd == 'get' and args in self.cache:
waiting_for.append(fetch_from_cache(args))
if cmd == 'get' and args[0] in self.cache:
waiting_for.append(fetch_from_cache(args[0]))
else:
self.msgid += 1
waiting_for.append(self.msgid)
self.to_send = msgpack.packb((1, self.msgid, cmd, args))
if not self.to_send and self.preload_ids:
args = (self.preload_ids.pop(0),)
chunk_id = self.preload_ids.pop(0)
args = (chunk_id,)
self.msgid += 1
self.cache.setdefault(args, []).append(self.msgid)
self.cache.setdefault(chunk_id, []).append(self.msgid)
self.to_send = msgpack.packb((1, self.msgid, 'get', args))
if self.to_send: