Skip to content

Commit

Permalink
Better handling of fw fetch.
Browse files Browse the repository at this point in the history
  • Loading branch information
brndnmtthws committed Dec 2, 2018
1 parent 82f521d commit 63e7c40
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions mother_of_dragons/firmware.py
Expand Up @@ -26,11 +26,13 @@ def get_firmware_path(self, url):
gevent.sleep(1)
if filename in self.firmwares:
return self.firmwares[filename]
elif filename not in self.firmwares_to_fetch:
else:
self.firmwares_being_fetched.add(filename)
# file doesn't exist locally, fetch it
result = self._fetch_firmware(url, filename)
self.firmwares_being_fetched.discard(filename)
try:
result = self._fetch_firmware(url, filename)
finally:
self.firmwares_being_fetched.discard(filename)
return result

def _fetch_firmware(self, url, filename):
Expand Down

0 comments on commit 63e7c40

Please sign in to comment.