Skip to content

Commit ff75340

Browse files
committed
fix: ensure idempotent token is always unique
1 parent df0ab4e commit ff75340

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/Traits/CanRecognizeVideos.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Meema\MediaRecognition\Traits;
44

55
use Exception;
6+
use Illuminate\Support\Str;
67

78
trait CanRecognizeVideos
89
{
@@ -34,7 +35,8 @@ protected function setVideoSettings($type): void
3435
'SNSTopicArn' => config('media-recognition.sns_topic_arn'),
3536
];
3637

37-
$uniqueId = $type.'_'.$this->mediaId;
38+
$uniqueId = $type.'_'.$this->mediaId.'_'.Str::random(6);
39+
3840
// Idempotent token used to identify the start request.
3941
// If you use the same token with multiple StartCelebrityRecognition requests, the same JobId is returned.
4042
// Use ClientRequestToken to prevent the same job from being accidentally started more than once.

0 commit comments

Comments
 (0)