mirror of
https://github.com/AnimeThemes/animethemes-server.git
synced 2026-07-11 01:24:46 +02:00
fix: attempt to lock for update (#976)
This commit is contained in:
@@ -25,7 +25,7 @@ class DestroyTrackAction
|
||||
|
||||
// Lock tracks to prevent race conditions.
|
||||
Playlist::query()->whereKey($playlist->getKey())->lockForUpdate()->first();
|
||||
$playlist->tracks()->getQuery()->lockForUpdate()->count();
|
||||
$playlist->tracks()->select(PlaylistTrack::ATTRIBUTE_ID)->lockForUpdate()->get();
|
||||
|
||||
$removeAction = new RemoveTrackAction();
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ class StoreTrackAction
|
||||
|
||||
// Lock tracks to prevent race conditions.
|
||||
Playlist::query()->whereKey($playlist->getKey())->lockForUpdate()->first();
|
||||
$playlist->tracks()->getQuery()->lockForUpdate()->count();
|
||||
$playlist->tracks()->select(PlaylistTrack::ATTRIBUTE_ID)->lockForUpdate()->get();
|
||||
|
||||
/** @var StoreAction<PlaylistTrack> $storeAction */
|
||||
$storeAction = new StoreAction();
|
||||
|
||||
@@ -33,7 +33,7 @@ class UpdateTrackAction
|
||||
|
||||
// Lock tracks to prevent race conditions.
|
||||
Playlist::query()->whereKey($playlist->getKey())->lockForUpdate()->first();
|
||||
$playlist->tracks()->getQuery()->lockForUpdate()->count();
|
||||
$playlist->tracks()->select(PlaylistTrack::ATTRIBUTE_ID)->lockForUpdate()->get();
|
||||
|
||||
/** @var UpdateAction<PlaylistTrack> $updateAction */
|
||||
$updateAction = new UpdateAction();
|
||||
|
||||
@@ -79,10 +79,15 @@ class DiscordEmbedField implements Arrayable, JsonSerializable
|
||||
}
|
||||
|
||||
// Encode to json for all other non-empty scalar values
|
||||
if ((is_scalar($value) || $value instanceof Stringable) && Str::length($value) > 0) {
|
||||
if (is_scalar($value) && Str::length($value) > 0) {
|
||||
return strval($value);
|
||||
}
|
||||
|
||||
// Convert Stringable objects to string
|
||||
if ($value instanceof Stringable && filled($value)) {
|
||||
return (string) $value;
|
||||
}
|
||||
|
||||
return self::DEFAULT_FIELD_VALUE;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user