mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-14 12:30:49 +08:00
job add middleware
This commit is contained in:
@@ -10,6 +10,7 @@ use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Nexus\Database\NexusDB;
|
||||
|
||||
@@ -55,6 +56,16 @@ class UpdateTorrentSeedersEtc implements ShouldQueue
|
||||
|
||||
public $timeout = 1800;
|
||||
|
||||
/**
|
||||
* 获取任务时,应该通过的中间件。
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function middleware()
|
||||
{
|
||||
return [new WithoutOverlapping($this->idRedisKey)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
*
|
||||
@@ -63,7 +74,10 @@ class UpdateTorrentSeedersEtc implements ShouldQueue
|
||||
public function handle()
|
||||
{
|
||||
$beginTimestamp = time();
|
||||
$logPrefix = sprintf("[CLEANUP_CLI_UPDATE_TORRENT_SEEDERS_ETC_HANDLE_JOB], 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, idStr: %s, idRedisKey: %s",
|
||||
$this->requestId, $this->beginTorrentId, $this->endTorrentId, $this->idStr, $this->idRedisKey
|
||||
);
|
||||
|
||||
$idStr = $this->idStr;
|
||||
$delIdRedisKey = false;
|
||||
|
||||
Reference in New Issue
Block a user