Use the new async response framework when setting background/logo images via RC. Avoids having to use --no-response

This commit is contained in:
Kovid Goyal
2021-12-05 18:02:09 +05:30
parent e91c008357
commit 3f0ecbb241
3 changed files with 27 additions and 28 deletions

View File

@@ -45,12 +45,12 @@ def handle_cmd(boss: BossType, window: Optional[WindowType], serialized_cmd: str
payload['peer_id'] = peer_id
async_id = str(cmd.get('async', ''))
if async_id:
payload['async_id'] = async_id
if 'cancel_async' in cmd:
active_async_requests.pop(async_id, None)
c.cancel_async_request(boss, window, PayloadGetter(c, payload))
return None
active_async_requests[async_id] = monotonic()
payload['async_id'] = async_id
if len(active_async_requests) > 32:
oldest = next(iter(active_async_requests))
del active_async_requests[oldest]