diff --git a/app/Jobs/FolderAddEntity.php b/app/Jobs/FolderAddEntity.php index 7d19479..13ed340 100644 --- a/app/Jobs/FolderAddEntity.php +++ b/app/Jobs/FolderAddEntity.php @@ -10,7 +10,6 @@ use App\Notifications\EntityUpdated; use App\Services\FederationService; use App\Services\NotificationService; -use App\Services\QueueService; use App\Traits\HandlesJobsFailuresTrait; use Illuminate\Bus\Queueable; use Illuminate\Contracts\Queue\ShouldQueue; @@ -78,12 +77,7 @@ public function handle(): void NotificationService::sendModelNotification($this->entity, new EntityUpdated($this->entity)); } } - - $jobExists = QueueService::jobExists(FolderAddEntity::class, $this->entity->id); - - if ($jobExists) { - RunMdaScript::dispatch($federation, $lock->owner()); - } + RunMdaScript::dispatch($federation, $lock->owner()); } catch (Exception $e) { $this->fail($e); diff --git a/app/Providers/AppServiceProvider.php b/app/Providers/AppServiceProvider.php index 3eb3f79..2344f41 100644 --- a/app/Providers/AppServiceProvider.php +++ b/app/Providers/AppServiceProvider.php @@ -71,7 +71,7 @@ public function boot() Notification::sendNow($admins, new TooManyRequests(User::find($key))); return redirect()->back() - ->with('status', 'error') + ->with('status', __('notifications.too_many_requests_subject_notification')) ->with('color', 'red'); }); }); diff --git a/app/Services/QueueService.php b/app/Services/QueueService.php deleted file mode 100644 index 79d8a18..0000000 --- a/app/Services/QueueService.php +++ /dev/null @@ -1,45 +0,0 @@ -where('payload', 'like', '%'.$jobClass.'%') - ->where('payload', 'like', '%'.$identifier.'%') - ->exists(); - } - - private static function checkRedisQueue(string $jobClass, $identifier): bool - { - $queue = config('queue.connections.redis.queue', 'default'); - $jobs = Redis::lrange('queues:'.$queue, 0, -1); - - foreach ($jobs as $job) { - if (str_contains($job, $jobClass) && str_contains($job, (string) $identifier)) { - return true; - } - } - - return false; - } -} diff --git a/lang/cs/notifications.php b/lang/cs/notifications.php index d06e57f..a04b9fd 100644 --- a/lang/cs/notifications.php +++ b/lang/cs/notifications.php @@ -94,4 +94,5 @@ 'entity_deleted_from_rs_body' => 'Entita :name již není součástí kategorie entit R&S.', 'too_many_requests_body' => 'Bylo provedeno příliž mnoho pokusů o změnu souboru uživatelem :user', 'too_many_requests_subject' => 'podezřelá aktivita', + 'too_many_requests_subject_notification' => 'Bylo provedeno příliž mnoho pokusů o změnu entity, počkejte minutu zkuste znovu', ]; diff --git a/lang/en/notifications.php b/lang/en/notifications.php index f5a800d..154fbb7 100644 --- a/lang/en/notifications.php +++ b/lang/en/notifications.php @@ -94,4 +94,5 @@ 'entity_deleted_from_rs_body' => ':name is not member of R&S entity category anymore.', 'too_many_requests_body' => 'multiple attempts to modify the file were made by the user :user', 'too_many_requests_subject' => 'suspicious activity', + 'too_many_requests_subject_notification' => 'multiple attempts to modify the entity were made, please wait a minute and try again.', ];