Page Menu
Home
Software Heritage
Search
Configure Global Search
Log In
Files
F9342752
D3164.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Subscribers
None
D3164.diff
View Options
diff --git a/swh/scheduler/celery_backend/runner.py b/swh/scheduler/celery_backend/runner.py
--- a/swh/scheduler/celery_backend/runner.py
+++ b/swh/scheduler/celery_backend/runner.py
@@ -47,6 +47,8 @@
task_type_name = task_type["type"]
task_types[task_type_name] = task_type
max_queue_length = task_type["max_queue_length"]
+ if max_queue_length is None:
+ max_queue_length = 0
backend_name = task_type["backend_name"]
if max_queue_length:
try:
@@ -61,7 +63,9 @@
num_tasks = min(max_queue_length - queue_length, MAX_NUM_TASKS)
else:
num_tasks = MAX_NUM_TASKS
- if num_tasks > 0:
+ # only pull tasks if the buffer is at least 1/5th empty (= 80%
+ # full), to help postgresql use properly indexed queries.
+ if num_tasks > min(MAX_NUM_TASKS, max_queue_length) // 5:
num_tasks, num_tasks_priority = compute_nb_tasks_from(num_tasks)
grabbed_tasks = backend.grab_ready_tasks(
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Jul 3, 12:59 PM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3215201
Attached To
D3164: Celery runner: only schedule tasks when the buffer is less than 80% full
Event Timeline
Log In to Comment