Bånder

SyncSongMetadataJob extends BaseJob
in package
implements ShouldQueue uses Dispatchable, InteractsWithQueue, Queueable, SerializesModels

Table of Contents

Interfaces

ShouldQueue

Properties

$forceUpdate  : bool
$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.
$songId  : int

Methods

__construct()  : mixed
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.
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
updateSongArtists()  : void
updateSongGenres()  : void
updateSongMetadata()  : void

Properties

$logger

private LoggerInterface $logger
Attributes
#[LogChannel]
$channel: \App\Modules\Logging\Channel::Metadata
$defaultContext: ['job_type' => 'metadata_sync']

$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(int $songId[, bool $forceUpdate = false ]) : mixed
Parameters
$songId : int
$forceUpdate : bool = false

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
bool

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
int

queueData()

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
LoggerInterface

getLogChannelAttribute()

private getLogChannelAttribute(ReflectionProperty $property) : LogChannel|null
Parameters
$property : ReflectionProperty
Return values
LogChannel|null

isQueueProgressOnCooldown()

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
bool

shouldInitializeLogger()

private shouldInitializeLogger(ReflectionProperty $property) : bool
Parameters
$property : ReflectionProperty
Return values
bool

updateSongArtists()

private updateSongArtists(Song $song, array<string|int, mixed> $artistsData) : void
Parameters
$song : Song
$artistsData : array<string|int, mixed>

updateSongGenres()

private updateSongGenres(Song $song, array<string|int, mixed> $genreNames) : void
Parameters
$song : Song
$genreNames : array<string|int, mixed>

updateSongMetadata()

private updateSongMetadata(Song $song, array<string|int, mixed> $results) : void
Parameters
$song : Song
$results : array<string|int, mixed>

        
On this page

Search results