我的项目使用救援运行后台作业。我在作业中使用actioncable在作业完成时通知用户。但是它在使用perform_later时不运行,但是perform_now =>运行得很好。
我的工作:
class FetchExternalDataJob < ApplicationJob
queue_as :default
def perform
# logic here
ActionCable.server.broadcast "some_channel", message: "finish job"
end
end呼叫作业:
class RoomsController < ApplicationController
def show
FetchExternalDataJob.perform_later
end通道javascript:
App.fetch_data = App.cable.subscriptions.create "FetchDataChannel",
received: (data) ->
console.log("job finished")发布于 2017-11-06 06:40:16
您在cable.yml中将redis设置为您的适配器了吗?
ei:
development:
adapter: redis
url: redis://localhost:6379/1https://stackoverflow.com/questions/42712201
复制相似问题