Skip to content

Fix concurrent tasks#48

Merged
landryb merged 6 commits intomasterfrom
fix-concurrent-task
Mar 19, 2026
Merged

Fix concurrent tasks#48
landryb merged 6 commits intomasterfrom
fix-concurrent-task

Conversation

@landryb
Copy link
Copy Markdown
Member

@landryb landryb commented Mar 19, 2026

When a user goes to a page that triggers a task (such as /csw/srv when the geonetwork contents werent found in the cache, or /admin/geoserver/datadir when the datadir view wasnt found in memory), avoid queuing another task if there's already one running with the same name and args.

landryb added 6 commits March 19, 2026 12:52
as stated in https://docs.celeryq.dev/en/v5.6.1/userguide/workers.html#remote-control:

'The solo pool supports remote control commands, but any task executing will
block any waiting control command, so it is of limited use if the worker is
very busy.'

This prevents inspecting a worker when it is running a task, so better switch
to another pool type.
/tasks/inspect.json dumps worker active queues as json
will inspect the worker queues for a running task with the same name and args,
and return its task id directly instead of queuing a new identical task.

this way if the user reloads a page triggering a task (such as /csw/srv or
/admin/geoserver/datadir) we wont queue another task, and just wait for the
completion of the already running task.
@landryb landryb merged commit 02a27fe into master Mar 19, 2026
landryb added a commit that referenced this pull request Mar 19, 2026
this can happen if no celery worker is running, and in this case
active_tasks.items() blows.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant