Ruby on rails ActionCable未在后台作业rails 5中运行
我的项目使用rescue来运行后台作业。 我在作业中使用actioncable在作业完成时通知用户。但是当以后使用perform_时它不会运行,但是现在perform_=>它工作正常 我的工作:Ruby on rails ActionCable未在后台作业rails 5中运行,ruby-on-rails,ruby-on-rails-5,actioncable,rescue,Ruby On Rails,Ruby On Rails 5,Actioncable,Rescue,我的项目使用rescue来运行后台作业。 我在作业中使用actioncable在作业完成时通知用户。但是当以后使用perform_时它不会运行,但是现在perform_=>它工作正常 我的工作: class FetchExternalDataJob < ApplicationJob queue_as :default def perform # logic here ActionCable.server.broadcast "some_channel", mess
class FetchExternalDataJob < ApplicationJob
queue_as :default
def perform
# logic here
ActionCable.server.broadcast "some_channel", message: "finish job"
end
end
您是否已将redis设置为cable.yml中的适配器 ei:
也许您缺少了从队列中实际拾取作业的工作人员?这是正确的,只是我使用了url作为
//localhost:6379/0
而不是//localhost:6379/1
class RoomsController < ApplicationController
def show
FetchExternalDataJob.perform_later
end
App.fetch_data = App.cable.subscriptions.create "FetchDataChannel",
received: (data) ->
console.log("job finished")
development:
adapter: redis
url: redis://localhost:6379/1