diff --git a/app/Jobs/OrderHandleJob.php b/app/Jobs/OrderHandleJob.php index bbd34d8e..d6626d1c 100644 --- a/app/Jobs/OrderHandleJob.php +++ b/app/Jobs/OrderHandleJob.php @@ -15,6 +15,8 @@ class OrderHandleJob implements ShouldQueue use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; protected $order; + public $tries = 3; + public $timeout = 5; /** * Create a new job instance. * diff --git a/app/Jobs/SendEmailJob.php b/app/Jobs/SendEmailJob.php index 5d8ff56e..2f4fa154 100644 --- a/app/Jobs/SendEmailJob.php +++ b/app/Jobs/SendEmailJob.php @@ -16,6 +16,8 @@ class SendEmailJob implements ShouldQueue use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; protected $params; + public $tries = 3; + public $timeout = 10; /** * Create a new job instance. * diff --git a/app/Jobs/SendTelegramJob.php b/app/Jobs/SendTelegramJob.php index d2cafed6..8d30344f 100644 --- a/app/Jobs/SendTelegramJob.php +++ b/app/Jobs/SendTelegramJob.php @@ -16,7 +16,7 @@ class SendTelegramJob implements ShouldQueue protected $text; public $tries = 3; - public $timeout = 5; + public $timeout = 10; /** * Create a new job instance. diff --git a/app/Jobs/StatServerJob.php b/app/Jobs/StatServerJob.php index 93a42acd..8e56d9fe 100644 --- a/app/Jobs/StatServerJob.php +++ b/app/Jobs/StatServerJob.php @@ -19,7 +19,7 @@ class StatServerJob implements ShouldQueue protected $recordType; public $tries = 3; - public $timeout = 60; + public $timeout = 10; /** * Create a new job instance. @@ -53,16 +53,8 @@ class StatServerJob implements ShouldQueue ->where('server_id', $this->server['id']) ->where('server_type', $this->protocol) ->first(); - if ($data) { - try { - $data->update([ - 'u' => $data['u'] + $this->u, - 'd' => $data['d'] + $this->d - ]); - } catch (\Exception $e) { - abort(500, '节点统计数据更新失败'); - } - } else { + + if (!$data) { if (!StatServer::create([ 'server_id' => $this->server['id'], 'server_type' => $this->protocol, @@ -73,6 +65,16 @@ class StatServerJob implements ShouldQueue ])) { abort(500, '节点统计数据创建失败'); } + return; + } + + try { + $data->update([ + 'u' => $data['u'] + $this->u, + 'd' => $data['d'] + $this->d + ]); + } catch (\Exception $e) { + abort(500, '节点统计数据更新失败'); } } } diff --git a/app/Jobs/StatUserJob.php b/app/Jobs/StatUserJob.php index 0d1dd5b0..79d908f0 100644 --- a/app/Jobs/StatUserJob.php +++ b/app/Jobs/StatUserJob.php @@ -21,7 +21,7 @@ class StatUserJob implements ShouldQueue protected $recordType; public $tries = 3; - public $timeout = 60; + public $timeout = 10; /** * Create a new job instance. diff --git a/app/Jobs/TrafficFetchJob.php b/app/Jobs/TrafficFetchJob.php index 71b500a6..2d2e077c 100644 --- a/app/Jobs/TrafficFetchJob.php +++ b/app/Jobs/TrafficFetchJob.php @@ -20,7 +20,7 @@ class TrafficFetchJob implements ShouldQueue protected $protocol; public $tries = 3; - public $timeout = 3; + public $timeout = 10; /** * Create a new job instance.