New scheduler queue in Sidekiq : how to?

Hello !

I found that trending tags didn’t seem to be refreshed anymore on my instance for some time now.
I checked the Recurring Tasks (Tâches récurrentes in french) in Sidekiq and it looks like this :


(Pas d’exécution prévue pour cette tâche = No execution planned for this task)
(semaines = weeks)

I updated Mastodon 3.2.1->3.2.2 on December 18th and 3.2.2->3.3.0 on December 27th. Everything seemed to have worked correctly.

Any idea? Thanks!

1 Like

I know it’s in link with this sentence in the Upgrade notes of the of the 3.3.0 :

:warning: Scheduled tasks have been moved to a dedicated scheduler queue in Sidekiq. If you only run a single Sidekiq process with no custom queue selection, you don’t need to change anything. If you customize Sidekiq processes/queues, ensure that there is exactly one Sidekiq process that runs the scheduler queue.

But I don’t know what to do.
It’s been a long time since I installed Mastodon from the source and I don’t remember tweaking the Sidekiq part so I didn’t feel targeted by this warning.
Here is my config/sidekiq.yml

---
:concurrency: 5
:queues:
  - [default, 6]
  - [push, 4]
  - [mailers, 2]
  - [pull]
  - [scheduler]
:scheduler:
  :listened_queues_only: true
:schedule:
  scheduled_statuses_scheduler:
    every: '5m'
    class: Scheduler::ScheduledStatusesScheduler
    queue: scheduler
  trending_tags_scheduler:
    every: '5m'
    class: Scheduler::TrendingTagsScheduler
    queue: scheduler
  media_cleanup_scheduler:
    cron: '<%= Random.rand(0..59) %> <%= Random.rand(3..5) %> * * *'
    class: Scheduler::MediaCleanupScheduler
    queue: scheduler
  feed_cleanup_scheduler:
    cron: '<%= Random.rand(0..59) %> <%= Random.rand(0..2) %> * * *'
    class: Scheduler::FeedCleanupScheduler
    queue: scheduler
  doorkeeper_cleanup_scheduler:
    cron: '<%= Random.rand(0..59) %> <%= Random.rand(0..2) %> * * 0'
    class: Scheduler::DoorkeeperCleanupScheduler
    queue: scheduler
  user_cleanup_scheduler:
    cron: '<%= Random.rand(0..59) %> <%= Random.rand(4..6) %> * * *'
    class: Scheduler::UserCleanupScheduler
    queue: scheduler
  ip_cleanup_scheduler:
    cron: '<%= Random.rand(0..59) %> <%= Random.rand(3..5) %> * * *'
    class: Scheduler::IpCleanupScheduler
    queue: scheduler
  email_scheduler:
    cron: '0 10 * * 2'
    class: Scheduler::EmailScheduler
    queue: scheduler
  backup_cleanup_scheduler:
    cron: '<%= Random.rand(0..59) %> <%= Random.rand(3..5) %> * * *'
    class: Scheduler::BackupCleanupScheduler
    queue: scheduler
  pghero_scheduler:
    cron: '0 0 * * *'
    class: Scheduler::PgheroScheduler
    queue: scheduler
  instance_refresh_scheduler:
    cron: '0 * * * *'
    class: Scheduler::InstanceRefreshScheduler
    queue: scheduler

Or is it in /etc/systemd/system/mastodon-sidekiq.service ?

[Unit]
Description=mastodon-sidekiq
After=network.target

[Service]
Type=simple
User=mastodon
WorkingDirectory=/home/mastodon/live
Environment="RAILS_ENV=production"
Environment="DB_POOL=5"
Environment="LD_PRELOAD=/usr/lib/x86_64-linux-gnu/libjemalloc.so.1"
ExecStart=/home/mastodon/.rbenv/shims/bundle exec sidekiq -c 5 -q default -q push -q mailers -q pull
TimeoutSec=15
Restart=always

[Install]
WantedBy=multi-user.target

Ok, I think I have the solution, but let me know if I forget something.

I added -q scheduler at the end of the ExecStart in mastodon-sidekiq.service.
Then systemctl daemon-reload and systemctl restart mastodon-sidekiq.service.
After few minutes, there is a sign that it worked :

1 Like