Skip to content

Commit

Permalink
try/catch/finally in download.py to avoid deadlock
Browse files Browse the repository at this point in the history
  • Loading branch information
mkst committed Jan 28, 2025
1 parent 03bfe3d commit 79d5b5d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions backend/compilers/download.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,15 +247,16 @@ def __init__(
def run(self):
while True:
try:
try:
item = self.download_queue.get_nowait()
except queue.Empty:
break
item = self.download_queue.get_nowait()
except queue.Empty:
break

try:
self.process_item(item)
self.download_queue.task_done()
except Exception as e:
logger.error("Exception thrown while processing item: %s", e)
break
finally:
self.download_queue.task_done()

def process_item(self, item):
platform_id, compiler_id = item
Expand Down Expand Up @@ -305,7 +306,7 @@ def main():
help="Name of github repo that owns the packages",
)
parser.add_argument(
"--threads", type=int, default=4, help="Number of download threads to use"
"--threads", type=int, default=8, help="Number of download threads to use"
)
parser.add_argument("--verbose", action="store_true", help="Enable DEBUG log level")
args = parser.parse_args()
Expand Down

0 comments on commit 79d5b5d

Please sign in to comment.