1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-29 11:16:43 +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 calls:
if is_preloaded: if is_preloaded:
assert cmd == "get", "is_preload is only supported for 'get'" assert cmd == "get", "is_preload is only supported for 'get'"
if calls[0] in self.cache: if calls[0][0] in self.cache:
waiting_for.append(fetch_from_cache(calls.pop(0))) waiting_for.append(fetch_from_cache(calls.pop(0)[0]))
else: else:
args = calls.pop(0) args = calls.pop(0)
if cmd == 'get' and args in self.cache: if cmd == 'get' and args[0] in self.cache:
waiting_for.append(fetch_from_cache(args)) waiting_for.append(fetch_from_cache(args[0]))
else: else:
self.msgid += 1 self.msgid += 1
waiting_for.append(self.msgid) waiting_for.append(self.msgid)
self.to_send = msgpack.packb((1, self.msgid, cmd, args)) self.to_send = msgpack.packb((1, self.msgid, cmd, args))
if not self.to_send and self.preload_ids: 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.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)) self.to_send = msgpack.packb((1, self.msgid, 'get', args))
if self.to_send: if self.to_send: