feat: add Snipe-IT asset synchronization
This commit is contained in:
32
app/Jobs/SyncSnipeAssets.php
Normal file
32
app/Jobs/SyncSnipeAssets.php
Normal file
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use App\Domain\Inventory\Services\AssetSyncService;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Queue\Queueable;
|
||||
|
||||
class SyncSnipeAssets implements ShouldBeUnique, ShouldQueue
|
||||
{
|
||||
use Queueable;
|
||||
|
||||
public int $tries = 3;
|
||||
|
||||
public int $timeout = 900;
|
||||
|
||||
public int $uniqueFor = 900;
|
||||
|
||||
/** @var list<int> */
|
||||
public array $backoff = [30, 120, 300];
|
||||
|
||||
public function uniqueId(): string
|
||||
{
|
||||
return 'snipe-it-assets';
|
||||
}
|
||||
|
||||
public function handle(AssetSyncService $syncService): void
|
||||
{
|
||||
$syncService->sync();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user