diff --git a/app/Console/Commands/Test.php b/app/Console/Commands/Test.php index 2f0a00f2..88302a2f 100644 --- a/app/Console/Commands/Test.php +++ b/app/Console/Commands/Test.php @@ -97,8 +97,10 @@ class Test extends Command */ public function handle() { - $r = executeCommand("php -r 'var_export(function_exists(\"pcntl_alarm\"));'"); - dd($r == 'true'); + $results = NexusDB::select("select torrent, peer_id, userid, group_concat(id) as ids from peers group by torrent, peer_id, userid having(count(*)) > 1 limit 20"); + dump($results); + $rep = new ToolRepository(); + $rep->removeDuplicatePeer(); } } diff --git a/app/Repositories/ToolRepository.php b/app/Repositories/ToolRepository.php index 3c18a2f7..d0f682e2 100644 --- a/app/Repositories/ToolRepository.php +++ b/app/Repositories/ToolRepository.php @@ -481,8 +481,9 @@ class ToolRepository extends BaseRepository { $size = 2000; while (true) { - $results = NexusDB::select("select torrent, peer_id, userid, group_concat(id) as ids from peers group by torrent, peer_id, userid having(count(*)) > 1 limit $size"); + $results = NexusDB::select("select torrent, userid, group_concat(id) as ids from peers group by torrent, peer_id, userid having(count(*)) > 1 limit $size"); if (empty($results)) { + do_log("[DELETE_DUPLICATED_PEERS], no data: ". last_query()); break; } do_log("[DELETE_DUPLICATED_PEERS], count: " . count($results));