2

为了测试我的邮件是否正在发送,我正在运行heroku run rails c -a my_app. 然后我将工作排入队列,并且排入队列很好。但是,当我去 Redis 并查看排队的作业时,该作业不存在。相反,它处于“重试”状态。

这就是我所看到的:

{"retry":true,"queue":"default","class":"ActiveJob::QueueAdapters::SidekiqAdapter::JobWrapper","args":[{"job_class":"SendMailJob","job_id":"4b4ba46f-94d7-45cd-b923-ec1678c73076","queue_name":"default","arguments":["any_help",{"_aj_globalid":"gid://gemfeedapi/User/546641393834330002000000"}]}],"jid":"f89235d7ab19f605ed0461a1","enqueued_at":1424175756.9351726,"error_message":"Error while trying to deserialize arguments: \nProblem:\n Document(s) not found for class User with id(s) 546641393834330002000000.\nSummary:\n When calling User.find with an id or array of ids, each parameter must match a document in the database or this error will be raised. The search was for the id(s): 546641393834330002000000 ... (1 total) and the following ids were not found: 546641393834330002000000.\nResolution:\n Search for an id that is in the database or set the Mongoid.raise_not_found_error configuration option to false, which will cause a nil to be returned instead of raising this error when searching for a single id, or only the matched documents when searching for multiples.","error_class":"ActiveJob::DeserializationError","failed_at":1424175773.317896,"retry_count":0}

但是,对象在数据库中。

我尝试添加after_create回调(Mongoid),但没有任何区别。

对正在发生的事情有任何想法吗?

谢谢。

4

2 回答 2

14

Sidekiq 非常快,以至于它在数据库提交事务之前执行您的工作。用于after_commit创建作业。

于 2015-02-17T16:46:27.870 回答
0

好吧,我的错。您需要启动一个新的 Heroku Worker Dyno 以使 Sidekiq 工作(它不会自动执行)。

于 2015-02-18T08:38:05.910 回答