clean peers + snatched table unique

This commit is contained in:
xiaomlove
2023-04-02 02:42:45 +08:00
parent caaf140beb
commit 4703cf7b28
7 changed files with 133 additions and 16 deletions

View File

@@ -95,8 +95,10 @@ class Test extends Command
*/
public function handle()
{
$logFile = format_description('[img=http://www.baidu.com][img]http://www.baidu.com[/img]');
dd($logFile);
$r = log(10);
$r2 = exp(10);
dd($r, $r2);
}
}

View File

@@ -706,7 +706,8 @@ HTML;
public function removeDuplicateSnatch()
{
$size = 2000;
$stickyPromotionExists = NexusDB::hasTable('');
$stickyPromotionParticipatorsTable = 'sticky_promotion_participators';
$stickyPromotionExists = NexusDB::hasTable($stickyPromotionParticipatorsTable);
while (true) {
$snatchRes = NexusDB::select("select userid, torrentid, group_concat(id) as ids from snatched group by userid, torrentid having(count(*)) > 1 limit $size");
if (empty($snatchRes)) {
@@ -723,6 +724,10 @@ HTML;
do_log("[DELETE_DUPLICATED_SNATCH], torrent: $torrentId, user: $userId, snatchIdStr: $delIdStr");
NexusDB::statement("delete from snatched where id in ($delIdStr)");
NexusDB::statement("update claims set snatched_id = $remainId where torrent_id = $torrentId and uid = $userId");
NexusDB::statement("update hit_and_runs set snatched_id = $remainId where torrent_id = $torrentId and uid = $userId");
if ($stickyPromotionExists) {
NexusDB::statement("update $stickyPromotionParticipatorsTable set snatched_id = $remainId where torrent_id = $torrentId and uid = $userId");
}
}
}
}