Skip to content

Latest commit

 

History

History
55 lines (40 loc) · 1.49 KB

background-jobs.md

File metadata and controls

55 lines (40 loc) · 1.49 KB

Background jobs

We use Sidekiq (backed by Redis) to handle sending emails and other asynchronous jobs. See ADR9.

The container which runs Sidekiq and processes 'jobs' taken from the Redis queue is defined in AWS task definitions as a "sideCar" container.

Sidekiq UI

The application provides the Sidekiq UI at /sidekiq for service owner users.

Debugging via console

You will first need to get a console on the environment, see the documentation for details.

See overview of jobs

Sidekiq::Stats.new gives us an overview. Here we see that 408 jobs are waiting to be re-tried:

> Sidekiq::Stats.new
=> #<Sidekiq::Stats:0x000055ce07bdabc0
 @stats=
  {:processed=>7818,
   :failed=>7344,
   :scheduled_size=>0,
   :retry_size=>408,
   :dead_size=>0,
   :processes_size=>1,
   :default_queue_latency=>0,
   :workers_size=>0,
   :enqueued=>0}>

Process jobs marked to be retried

rs = Sidekiq::RetrySet.new
=> #<Sidekiq::RetrySet:0x000055ce07a60150 @_size=408, @name="retry">

> rs.each { |job| job.retry }
=> nil

References

There is more useful info on the Sidekiq API at these two links. e.g. see the Sidekiq::Queue class and the Sidekiq::Stats.new.queues method: