IronQueue 发送作业两次



我正在使用Laravel 4.2和IronMQ2。出于某种原因,它会随机发送两次作业。在我的邮件中,我有:

Queue::push('MailController@fire', ['email' => $email, 'subject' => $subject, 'view' => $view, 'data' => $data, 'attachment' => $attachment]);

我可以通过登录我的邮件控制器来判断它正在多次发送,就在$job->delete()呼叫上方:

[2016-03-22 06:08:02] production.INFO: [MAIL LOGGING] Logging for job 6264815783870079319 [] [] - Duplicate 1
[2016-03-22 06:08:02] production.INFO: [MAIL LOGGING] Logging for job 6264815783870079319 [] [] - Duplicate 1
[2016-03-22 06:08:03] production.INFO: [MAIL LOGGING] Logging for job 6264815783870079316 [] [] - Duplicate 2
[2016-03-22 06:08:03] production.INFO: [MAIL LOGGING] Finish job for 6264815783870079319  [] [] - End duplicate 1
[2016-03-22 06:08:03] production.INFO: [MAIL LOGGING] Logging for job 6264815783870079316 [] [] - Duplicate 3
[2016-03-22 06:08:03] production.INFO: [MAIL LOGGING] Finish job for 6264815783870079316  [] [] - End duplicate 2
[2016-03-22 06:08:04] production.INFO: [MAIL LOGGING] Finish job for 6264815783870079316  [] [] - End duplicate 3
[2016-03-22 06:12:47] production.INFO: [MAIL LOGGING] Logging for job 6264815783870079319 [] [] - Duplicate 1
[2016-03-22 06:12:48] production.INFO: [MAIL LOGGING] Finish job for 6264815783870079319  [] [] - End duplicate 1
[2016-03-22 06:48:52] production.INFO: [MAIL LOGGING] Logging for job 6264826778986309904 [] [] - Duplicate 4
[2016-03-22 06:48:52] production.INFO: [MAIL LOGGING] Logging for job 6264826778986309904 [] [] - Duplicate 4
[2016-03-22 06:48:52] production.INFO: [MAIL LOGGING] Logging for job 6264826778986309902 [] [] - Duplicate 5
[2016-03-22 06:48:53] production.INFO: [MAIL LOGGING] Finish job for 6264826778986309902  [] [] - End Duplicate 5
[2016-03-22 06:48:53] production.INFO: [MAIL LOGGING] Finish job for 6264826778986309904  [] [] - End duplicate 4
[2016-03-22 07:54:12] production.INFO: [MAIL LOGGING] Logging for job 6264843610963505825 [] [] - Not duplicated
[2016-03-22 07:54:12] production.INFO: [MAIL LOGGING] Logging for job 6264843142812137221 [] [] - Not duplicated
[2016-03-22 07:54:12] production.INFO: [MAIL LOGGING] Finish job for 6264843610963505825  [] []
[2016-03-22 07:54:13] production.INFO: [MAIL LOGGING] Finish job for 6264843142812137221  [] []

如您所见,并非所有作业,重复的作业是在同一秒内完成的。有没有办法防止这种情况发生?它导致电子邮件多次发出。

其中一个

选项是迁移到 IronMQ V3。这是具有稳定性和性能增强的更新队列。

由于 IronMQ v2 是在 Laravel 4.2 中硬编码的,因此您需要执行以下操作:

  • 在 composer.json 中更新 IronMQ 版本:"iron-io/iron_mq": "4.*";
  • 更新应用程序/配置/队列中的主机.php,即 mq-aws-us-east-1-1.iron.io而不是mq-aws-us-east-1.iron.iomq-aws-eu-west-1-1.iron.io而不是mq-aws-eu-west-1.iron.io);
  • 将push_queue迁移到适当的 V3 群集(美国东部或欧洲西部);
  • vendorlaravelframeworksrcIlluminateQueue目录中,将IronQueue.phpIronJob.phpIronConnector.php文件替换为我共享的文件:
    https://onedrive.live.com/redir?resid=4DBE0885AEDA52FD!106&authkey=!AIr18HPOvqv6DE4&ithint=file%2czip

相关内容

  • 没有找到相关文章