【发布时间】:2018-12-07 23:38:06
【问题描述】:
我有一份执行状态更改的工作,而我使用它的方式是,状态仅在经过一定时间后才会更改。
在我的工作课上:
class ItemJob < ApplicationJob
queue_as :default
def perform(item)
item.do_this!
end
end
它是从模型中调用的:
def create_item_worker
ItemJob.set(wait: 30.seconds).perform_later(self)
end
但这不起作用,因为 ActiveJob 有一个作业队列,用于记录不再存在的记录。我在终端中输入bundle exec sidekiq,它会吐出像ActiveJob::DeserializationError: Error while trying to deserialize arguments: Couldn't find Item with 'id'=67 这样的废话。
那我该如何清除呢? Sidekiq::Queue.all.each(&:clear) 似乎什么也没做。
【问题讨论】:
标签: ruby-on-rails sidekiq rails-activejob