0
votes

I followed the railscast that describes how to get workling running background tasks, but can't get it working. The task runs, but not in the background (it's taking 5 secs before I'm redirected to admin_path).

Here is what my code looks like:

class AdminWorker < Workling::Base
  def test_workling(options)
    sleep 5
  end
end

class AdminController < ApplicationController
  def test_workling
    AdminWorker.asynch_test_workling
    flash[:notice] = "Doing stuff in the background"
    redirect_to admin_path
  end
end

What am I doing wrong? How to debug?

Thanks!

1

1 Answers

0
votes

I found out I had set up workling the right way:

in /config/environment.rb, I had:

Workling::Remote.dispatcher = Workling::Remote::Runners::NotRemoteRunner.new

while I was supposed to have:

Workling::Remote.dispatcher = Workling::Remote::Runners::StarlingRunner.new

It all went very smoothly after that change