Commit 3e4fee24 authored by Philipp Hörist's avatar Philipp Hörist
Browse files

fix: Handle race condition when cancelling request

Fixes #136
parent 50c8c1cd
......@@ -449,6 +449,17 @@ class HTTPRequest(GObject.GObject):
self._set_failed(HTTPRequestError.STATUS_NOT_OK)
return
self._log.info('Request status: %s', Soup.Status.get_phrase(status))
if self._cancellable.is_cancelled():
# It can happen that the message is finished before the
# response callback returns after calling cancel(). If
# we call complete, the response callback will also
# try to cleanup and will fail.
self._log.info('Skip setting message complete because '
'cancel is in progess')
return
self._set_complete()
def _set_failed(self, error: HTTPRequestError) -> None:
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment