延迟任务关闭订单,立即执行了?

部署多台服务器之后,延迟关闭订单的任务,会立即执行,在本地是正常的,这里不太明白哪里出了问题?
线上日志:

[2019-01-31 15:12:48] production.DEBUG: order_ttl [1800]
[2019-01-31 15:12:48] production.DEBUG: order_ttl_close {"address":{"address":"河北省 澳门 巫 Street 沈阳城东区","zip":56300,"contact_name":"卓宁","contact_phone":"13211670592"},"remark":null,"total_amount":7029,"type":"normal","user_id":11,"no":"20190131151248787931","updated_at":"2019-01-31 15:12:48","created_at":"2019-01-31 15:12:48","id":1110,"user":{"id":11,"name":"裴晧","phone":"13031617972","email":"atque.aperiam@example.com","is_email_verified":1,"created_at":"2019-01-28 10:37:47","updated_at":"2019-01-28 10:37:47"}}
[2019-01-31 15:12:48] production.DEBUG: order_ttl_delay [1800]
[2019-01-31 15:12:48] production.DEBUG: this close [1]

调试代码:

public function __construct(Order $order, $delay)
    {
        \Log::debug('order_ttl_close', $order->toArray());
        \Log::debug('order_ttl_delay', [$delay]);
        $this->order = $order;
        $this->delay = $delay;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        if ($this->order->paid_at) {
            return;
        }

        \DB::transaction(function () {
            \Log::debug('this close', [1]);
            $this->order->update(['closed' => true]);
            foreach ($this->order->items as $item) {
                $item->productSku->addStock($item->amount);
            }

            if ($this->order->couponCode) {
                $this->order->couponCode->changeUsed(false);
            }
        });
    }
《L03 构架 API 服务器》
你将学到如 RESTFul 设计风格、PostMan 的使用、OAuth 流程,JWT 概念及使用 和 API 开发相关的进阶知识。
《G01 Go 实战入门》
从零开始带你一步步开发一个 Go 博客项目,让你在最短的时间内学会使用 Go 进行编码。项目结构很大程度上参考了 Laravel。
leo
最佳答案

队列驱动是不是没有改成 redis?或者是配置被缓存了?

5年前 评论
讨论数量: 2
leo

队列驱动是不是没有改成 redis?或者是配置被缓存了?

5年前 评论

@leo 队列驱动没有改成redis,谢谢!!!

5年前 评论

讨论应以学习和精进为目的。请勿发布不友善或者负能量的内容,与人为善,比聪明更重要!