ruby-on-railssidekiq

What happends when a perform_async is called but sidekiq is not running?


I was wondering what happends when a perform_async is called on a worker but sidekiq (bundle exec sidekiq) isn't running ?

In my app I have some observers that ask sidekiq to do a job when one of my models is trigger (ie create, update or destroy in some cases).

I also have a rake task that builds me a database from some data I have.. When this task is running, it creates several records that trigger my observers who then push jobs in sidekiq queue.

For testing purpose I ran this task without turning on sidekiq and it's working fine, my data is being pushed in mysql !

I know ask myself what is happening to the job my observer tells my worker to do ? Is it still done ? Is it done but not asynchronously ? Is it not done ?


Solution

  • Simple answer: it is not done. It will be done later

    As the name it self is saying it puts it in a queue. When you turn on sidekiq it will read all data from queue and execute all tasks.

    But for this to work you need to have Redis working. Redis is responsible for saving data in a queue, it is a kind of memory. Without Redis you would get an error.