tracker always update torrent

This commit is contained in:
xiaomlove
2022-04-22 13:23:54 +08:00
parent b9190d9f6e
commit f72d5a0f56

View File

@@ -766,23 +766,19 @@ class TrackerRepository extends BaseRepository
*/
private function updateTorrent(Torrent $torrent, $queries, bool $isPeerExists)
{
if (empty($queries['event'])) {
do_log("no event, return", 'debug');
return;
if (!empty($queries['event'])) {
$torrent->seeders = Peer::query()
->where('torrent', $torrent->id)
->where('to_go', '=',0)
->count();
$torrent->leechers = Peer::query()
->where('torrent', $torrent->id)
->where('to_go', '>', 0)
->count();
}
$torrent->seeders = Peer::query()
->where('torrent', $torrent->id)
->where('to_go', '=',0)
->count();
$torrent->leechers = Peer::query()
->where('torrent', $torrent->id)
->where('to_go', '>', 0)
->count();
$torrent->visible = Torrent::VISIBLE_YES;
$torrent->last_action = Carbon::now();
if ($isPeerExists && $queries['event'] == 'completed') {
$torrent->times_completed = DB::raw("times_completed + 1");
}