My project use rescue to run background job. I use actioncable in a job to notify user when the job finish. but it not running when use perform_later, but perform_now => it work ok.
My job:
class FetchExternalDataJob < ApplicationJob
  queue_as :default
  def perform
    # logic here
    ActionCable.server.broadcast "some_channel", message: "finish job"
  end
end
Call job:
class RoomsController < ApplicationController
  def show
    FetchExternalDataJob.perform_later
  end
Channel javascript:
App.fetch_data = App.cable.subscriptions.create "FetchDataChannel",
  received: (data) ->
    console.log("job finished")
Have you set up redis as your adapter in cable.yml yet?
ei:
development:
  adapter: redis
  url: redis://localhost:6379/1
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With