1
0
mirror of https://github.com/EDCD/EDMarketConnector.git synced 2025-04-17 17:42:20 +03:00

edsm: Ensure Request handles are closed.

This commit is contained in:
Athanasius 2020-10-16 16:04:09 +01:00
parent 96953744c9
commit 745c2ce8d2

View File

@ -541,6 +541,8 @@ def worker() -> None:
r = this.session.get('https://www.edsm.net/api-journal-v1/discard', timeout=_TIMEOUT)
r.raise_for_status()
this.discardedEvents = set(r.json())
r.close()
this.discardedEvents.discard('Docked') # should_send() assumes that we send 'Docked' events
if not this.discardedEvents:
logger.error(
@ -632,7 +634,10 @@ def worker() -> None:
pending = []
r.close()
break # No exception, so assume success
except Exception as e:
logger.debug(f'Attempt to send API events: retrying == {retrying}', exc_info=e)
retrying += 1