mirror of
				https://github.com/v2board/v2board.git
				synced 2025-10-31 17:31:49 +08:00 
			
		
		
		
	update: job timeout
This commit is contained in:
		| @@ -15,6 +15,8 @@ class OrderHandleJob implements ShouldQueue | |||||||
|     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; | ||||||
|     protected $order; |     protected $order; | ||||||
|  |  | ||||||
|  |     public $tries = 3; | ||||||
|  |     public $timeout = 5; | ||||||
|     /** |     /** | ||||||
|      * Create a new job instance. |      * Create a new job instance. | ||||||
|      * |      * | ||||||
|   | |||||||
| @@ -16,6 +16,8 @@ class SendEmailJob implements ShouldQueue | |||||||
|     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; |     use Dispatchable, InteractsWithQueue, Queueable, SerializesModels; | ||||||
|     protected $params; |     protected $params; | ||||||
|  |  | ||||||
|  |     public $tries = 3; | ||||||
|  |     public $timeout = 10; | ||||||
|     /** |     /** | ||||||
|      * Create a new job instance. |      * Create a new job instance. | ||||||
|      * |      * | ||||||
|   | |||||||
| @@ -16,7 +16,7 @@ class SendTelegramJob implements ShouldQueue | |||||||
|     protected $text; |     protected $text; | ||||||
|  |  | ||||||
|     public $tries = 3; |     public $tries = 3; | ||||||
|     public $timeout = 5; |     public $timeout = 10; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Create a new job instance. |      * Create a new job instance. | ||||||
|   | |||||||
| @@ -19,7 +19,7 @@ class StatServerJob implements ShouldQueue | |||||||
|     protected $recordType; |     protected $recordType; | ||||||
|  |  | ||||||
|     public $tries = 3; |     public $tries = 3; | ||||||
|     public $timeout = 60; |     public $timeout = 10; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Create a new job instance. |      * Create a new job instance. | ||||||
| @@ -53,16 +53,8 @@ class StatServerJob implements ShouldQueue | |||||||
|             ->where('server_id', $this->server['id']) |             ->where('server_id', $this->server['id']) | ||||||
|             ->where('server_type', $this->protocol) |             ->where('server_type', $this->protocol) | ||||||
|             ->first(); |             ->first(); | ||||||
|         if ($data) { |  | ||||||
|             try { |         if (!$data) { | ||||||
|                 $data->update([ |  | ||||||
|                     'u' => $data['u'] + $this->u, |  | ||||||
|                     'd' => $data['d'] + $this->d |  | ||||||
|                 ]); |  | ||||||
|             } catch (\Exception $e) { |  | ||||||
|                 abort(500, '节点统计数据更新失败'); |  | ||||||
|             } |  | ||||||
|         } else { |  | ||||||
|             if (!StatServer::create([ |             if (!StatServer::create([ | ||||||
|                 'server_id' => $this->server['id'], |                 'server_id' => $this->server['id'], | ||||||
|                 'server_type' => $this->protocol, |                 'server_type' => $this->protocol, | ||||||
| @@ -73,6 +65,16 @@ class StatServerJob implements ShouldQueue | |||||||
|             ])) { |             ])) { | ||||||
|                 abort(500, '节点统计数据创建失败'); |                 abort(500, '节点统计数据创建失败'); | ||||||
|             } |             } | ||||||
|  |             return; | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         try { | ||||||
|  |             $data->update([ | ||||||
|  |                 'u' => $data['u'] + $this->u, | ||||||
|  |                 'd' => $data['d'] + $this->d | ||||||
|  |             ]); | ||||||
|  |         } catch (\Exception $e) { | ||||||
|  |             abort(500, '节点统计数据更新失败'); | ||||||
|         } |         } | ||||||
|     } |     } | ||||||
| } | } | ||||||
|   | |||||||
| @@ -21,7 +21,7 @@ class StatUserJob implements ShouldQueue | |||||||
|     protected $recordType; |     protected $recordType; | ||||||
|  |  | ||||||
|     public $tries = 3; |     public $tries = 3; | ||||||
|     public $timeout = 60; |     public $timeout = 10; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Create a new job instance. |      * Create a new job instance. | ||||||
|   | |||||||
| @@ -20,7 +20,7 @@ class TrafficFetchJob implements ShouldQueue | |||||||
|     protected $protocol; |     protected $protocol; | ||||||
|  |  | ||||||
|     public $tries = 3; |     public $tries = 3; | ||||||
|     public $timeout = 3; |     public $timeout = 10; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * Create a new job instance. |      * Create a new job instance. | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user