mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 20:40:49 +08:00
improve job log
This commit is contained in:
@@ -52,7 +52,7 @@ class UpdateTorrentSeedersEtc implements ShouldQueue
|
||||
public function handle()
|
||||
{
|
||||
$beginTimestamp = time();
|
||||
$logPrefix = sprintf("[CLEANUP_CLI_UPDATE_TORRENT_SEEDERS_ETC], commonRequestId: %s, beginTorrentId: %s, endTorrentId: %s", $this->requestId, $this->beginTorrentId, $this->endTorrentId);
|
||||
$logPrefix = sprintf("[CLEANUP_CLI_UPDATE_TORRENT_SEEDERS_ETC_HANDLE_JOB], commonRequestId: %s, beginTorrentId: %s, endTorrentId: %s", $this->requestId, $this->beginTorrentId, $this->endTorrentId);
|
||||
// $sql = sprintf("update torrents set seeders = (select count(*) from peers where torrent = torrents.id and seeder = 'yes'), leechers = (select count(*) from peers where torrent = torrents.id and seeder = 'no'), comments = (select count(*) from comments where torrent = torrents.id) where id > %s and id <= %s",
|
||||
// $this->beginTorrentId, $this->endTorrentId
|
||||
// );
|
||||
@@ -88,7 +88,7 @@ class UpdateTorrentSeedersEtc implements ShouldQueue
|
||||
}
|
||||
}
|
||||
NexusDB::table('torrents')->where('id', $torrent->id)->update($update);
|
||||
do_log("$logPrefix, [SUCCESS]: $torrent->id => " . json_encode($update));
|
||||
do_log("[CLEANUP_CLI_UPDATE_TORRENT_SEEDERS_ETC_HANDLE_TORRENT], [SUCCESS]: $torrent->id => " . json_encode($update));
|
||||
}
|
||||
$costTime = time() - $beginTimestamp;
|
||||
do_log(sprintf(
|
||||
@@ -96,4 +96,15 @@ class UpdateTorrentSeedersEtc implements ShouldQueue
|
||||
count($torrents), $costTime
|
||||
));
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle a job failure.
|
||||
*
|
||||
* @param \Throwable $exception
|
||||
* @return void
|
||||
*/
|
||||
public function failed(\Throwable $exception)
|
||||
{
|
||||
do_log("failed: " . $exception->getMessage() . $exception->getTraceAsString(), 'error');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user