mirror of
https://github.com/lkddi/Xboard.git
synced 2026-04-14 19:40:53 +08:00
fix: 优化流量消费队列,防止记录长时间被锁住
This commit is contained in:
@@ -170,9 +170,13 @@ class UserService
|
||||
|
||||
public function trafficFetch(array $server, string $protocol, array $data, string $nodeIp = null)
|
||||
{
|
||||
// 获取子节点
|
||||
$childServer = ($server['parent_id'] == null && !blank($nodeIp))
|
||||
? (new ServerService())->getChildServer($server['id'], $protocol, $nodeIp)
|
||||
: null;
|
||||
$timestamp = strtotime(date('Y-m-d'));
|
||||
collect($data)->chunk(1000)->each(function($chunk) use ($timestamp,$server,$protocol, $nodeIp){
|
||||
TrafficFetchJob::dispatch($server, $chunk->toArray(), $protocol, $timestamp, $nodeIp);
|
||||
collect($data)->chunk(1000)->each(function($chunk) use ($timestamp,$server,$protocol, $childServer){
|
||||
TrafficFetchJob::dispatch($server, $chunk->toArray(), $protocol, $timestamp, $childServer);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user