Skip to content

WOPI configuration periodic task never runs with DatabaseScheduler #484

@mosa-riel

Description

@mosa-riel

The WOPI configuration task (configure_wopi_clients) is registered using add_periodic_task() in wopi/tasks/configure_wopi.py, but the application is configured to use DatabaseScheduler in settings.py. These are incompatible - the task never runs automatically.

Evidence:

  1. drive/settings.py:483 configures:
    CELERY_BEAT_SCHEDULER = "django_celery_beat.schedulers:DatabaseScheduler"

  2. wopi/tasks/configure_wopi.py:20-28 registers the task using:

  @celery_app.on_after_configure.connect
  def setup_periodic_tasks(sender: Celery, **kwargs):
      sender.add_periodic_task(
          crontab(minute="0"),
          configure_wopi_clients.s(),
          name="configure_wopi_clients_every_hour",
      )
  1. add_periodic_task() only works with the default in-memory scheduler, not DatabaseScheduler

Impact:

  • WOPI configuration is never cached in Redis
  • is_wopi_supported returns False for all files
  • Collabora/OnlyOffice integration appears broken
  • Users must manually run python manage.py trigger_wopi_configuration after every deployment

Suggested Fix:

Add a data migration or AppConfig.ready() hook to register the task in the database:

from django_celery_beat.models import PeriodicTask, CrontabSchedule

schedule, _ = CrontabSchedule.objects.get_or_create(minute='0', hour='*')
PeriodicTask.objects.update_or_create(
    name='configure_wopi_clients_every_hour',
    defaults={
        'task': 'wopi.tasks.configure_wopi.configure_wopi_clients',
        'crontab': schedule,
        'enabled': True,
    }
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions