ScanMusicLibraryJob
extends BaseJob
in package
implements
ShouldQueue, ShouldBeUnique
Table of Contents
Interfaces
- ShouldQueue
- ShouldBeUnique
Properties
- $library : Library
- $logger : LoggerInterface
- $loggerCache : array<string|int, mixed>
- $progressCurrentChunk : int
- Internal variable used for tracking chunking progress.
- $progressLastUpdated : int|null
- The unix timestamp explaining the last time a progress has been written to database.
Methods
- __construct() : mixed
- failed() : void
- handle() : void
- keepMonitorOnSuccess() : bool
- Weather to keep successful monitor models. This can be used if you only want to keep failed monitors for jobs that are frequently executed but worth to monitor. You are free to use the Laravel built-in failed job procedures.
- middleware() : array<string|int, mixed>
- progressCooldown() : int
- The time in seconds to wait before a following queue progress update will be issued.
- queueData() : void
- Set Monitor data.
- queueProgress() : void
- Update progress.
- queueProgressChunk() : void
- Automatically update the current progress in each chunk iteration.
- deleteQueueMonitor() : void
- Delete Queue Monitor object.
- getLogger() : LoggerInterface
- getQueueMonitor() : QueueMonitor|null
- Return Queue Monitor Model.
- getLogChannelAttribute() : LogChannel|null
- isQueueProgressOnCooldown() : bool
- Check if the monitor should skip writing the progress to database avoiding rapid update queries.
- shouldInitializeLogger() : bool
Properties
$library read-only
private
Library
$library
$logger
private
LoggerInterface
$logger
Attributes
- #[LogChannel]
- $channel: \App\Modules\Logging\Channel::Metadata
$loggerCache
private
array<string|int, mixed>
$loggerCache
= []
$progressCurrentChunk
Internal variable used for tracking chunking progress.
private
int
$progressCurrentChunk
= 0
$progressLastUpdated
The unix timestamp explaining the last time a progress has been written to database.
private
int|null
$progressLastUpdated
Methods
__construct()
public
__construct(Library $library) : mixed
Parameters
- $library : Library
failed()
public
failed(Throwable $exception) : void
Parameters
- $exception : Throwable
handle()
public
handle() : void
keepMonitorOnSuccess()
Weather to keep successful monitor models. This can be used if you only want to keep failed monitors for jobs that are frequently executed but worth to monitor. You are free to use the Laravel built-in failed job procedures.
public
static keepMonitorOnSuccess() : bool
Return values
boolmiddleware()
public
middleware() : array<string|int, mixed>
Return values
array<string|int, mixed>progressCooldown()
The time in seconds to wait before a following queue progress update will be issued.
public
progressCooldown() : int
This is used to avoid writing many progress updates to the database. 0 = no delay.
Return values
intqueueData()
Set Monitor data.
public
queueData(array<string|int, mixed> $data[, bool $merge = false ]) : void
Parameters
- $data : array<string|int, mixed>
-
Custom data
- $merge : bool = false
-
Merge the data instead of overriding
queueProgress()
Update progress.
public
queueProgress(int $progress) : void
Parameters
- $progress : int
-
Progress as integer 0-100
queueProgressChunk()
Automatically update the current progress in each chunk iteration.
public
queueProgressChunk(int $collectionCount, int $perChunk) : void
Parameters
- $collectionCount : int
-
The total collection item amount
- $perChunk : int
-
The size of each chunk
deleteQueueMonitor()
Delete Queue Monitor object.
protected
deleteQueueMonitor() : void
getLogger()
protected
getLogger([string $propertyName = 'logger' ]) : LoggerInterface
Parameters
- $propertyName : string = 'logger'
Return values
LoggerInterfacegetQueueMonitor()
Return Queue Monitor Model.
protected
getQueueMonitor() : QueueMonitor|null
Return values
QueueMonitor|nullgetLogChannelAttribute()
private
getLogChannelAttribute(ReflectionProperty $property) : LogChannel|null
Parameters
- $property : ReflectionProperty
Return values
LogChannel|nullisQueueProgressOnCooldown()
Check if the monitor should skip writing the progress to database avoiding rapid update queries.
private
isQueueProgressOnCooldown(int $progress) : bool
The progress values 0, 25, 50, 75 and 100 will always be written.
Parameters
- $progress : int
Return values
boolshouldInitializeLogger()
private
shouldInitializeLogger(ReflectionProperty $property) : bool
Parameters
- $property : ReflectionProperty