Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify code
Browse files Browse the repository at this point in the history
Sultan Iman committed Jan 30, 2024
1 parent 76c79a7 commit 0bb5d2c
Showing 2 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion sources/scraping/__init__.py
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@ def scrapy_resource(

try:
if queue.is_closed:
raise QueueClosedError
raise QueueClosedError("Queue is closed")

result = queue.get(timeout=queue_result_timeout)
batch.append(result)
9 changes: 2 additions & 7 deletions sources/scraping/queue.py
Original file line number Diff line number Diff line change
@@ -27,13 +27,8 @@ def __init__(self, maxsize: int = 0) -> None:
self._is_closed = False

def close(self) -> None:
with self._state_lock:
if self._is_closed:
return

self._is_closed = True
self._is_closed = True

@property
def is_closed(self) -> bool:
with self._state_lock:
return self._is_closed
return self._is_closed

0 comments on commit 0bb5d2c

Please sign in to comment.