Skip to content

Commit

Permalink
meh
Browse files Browse the repository at this point in the history
  • Loading branch information
bartfeenstra committed Feb 4, 2024
1 parent 1a51b60 commit 8d68523
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion betty/app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ def concurrency(self) -> int:
with suppress(KeyError):
return int(stdos.environ['BETTY_CONCURRENCY'])
# Assume that any machine that runs Betty has at least two CPU cores.
return stdos.cpu_count() or 2
return (stdos.cpu_count() or 2) * 4

@property
def async_concurrency(self) -> int:
Expand Down
6 changes: 3 additions & 3 deletions betty/task.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,11 @@
class Context:
def __init__(self):
self._claims_lock = threading.Lock()
self._claimed_task_ids: MutableSequence[str] = []
self._claimed_task_ids: set[str] = set()

def claim(self, task_id: str) -> bool:
with self._claims_lock:
if task_id in self._claimed_task_ids:
return False
self._claimed_task_ids.append(task_id)
return True
self._claimed_task_ids.add(task_id)
return True

0 comments on commit 8d68523

Please sign in to comment.