diff --git a/ProcessMaker/Http/Controllers/Api/ScriptController.php b/ProcessMaker/Http/Controllers/Api/ScriptController.php index 2e7fc5c5dc..387df277a1 100644 --- a/ProcessMaker/Http/Controllers/Api/ScriptController.php +++ b/ProcessMaker/Http/Controllers/Api/ScriptController.php @@ -192,7 +192,7 @@ public function preview(Request $request, Script $script) $code = $request->get('code'); $nonce = $request->get('nonce'); - TestScript::dispatch($script, $request->user(), $code, $data, $config, $nonce)->onQueue('bpmn'); + TestScript::dispatch($script, $request->user(), $code, $data, $config, $nonce); return ['status' => 'success']; } @@ -253,7 +253,7 @@ public function execute(Request $request, ...$scriptKey) if ($request->get('sync') === true) { return (new ExecuteScript($script, $request->user(), $code, $data, $watcher, $config, true))->handle(); } else { - ExecuteScript::dispatch($script, $request->user(), $code, $data, $watcher, $config)->onQueue('bpmn'); + ExecuteScript::dispatch($script, $request->user(), $code, $data, $watcher, $config); } return ['status' => 'success', 'key' => $watcher]; diff --git a/ProcessMaker/Jobs/CatchSignalEvent.php b/ProcessMaker/Jobs/CatchSignalEvent.php index 3d1d0faee3..23de7d8f36 100644 --- a/ProcessMaker/Jobs/CatchSignalEvent.php +++ b/ProcessMaker/Jobs/CatchSignalEvent.php @@ -73,7 +73,7 @@ public function handle() $this->eventDefinition, $this->tokenId, $this->requestId - )->onQueue('bpmn'); + ); } $count = ProcessRequest::where('status', 'ACTIVE') ->where('id', '!=', $this->requestId); @@ -104,7 +104,7 @@ public function handle() $this->eventDefinition, $this->tokenId, $this->requestId - )->onQueue('bpmn'); + ); } } } diff --git a/ProcessMaker/Jobs/ErrorHandling.php b/ProcessMaker/Jobs/ErrorHandling.php index ea0049a742..6f74c45e48 100644 --- a/ProcessMaker/Jobs/ErrorHandling.php +++ b/ProcessMaker/Jobs/ErrorHandling.php @@ -83,7 +83,6 @@ private function requeue($job) ); } $newJob->delay($this->retryWaitTime()); - $newJob->onQueue('bpmn'); dispatch($newJob); } diff --git a/ProcessMaker/Jobs/RunScriptTask.php b/ProcessMaker/Jobs/RunScriptTask.php index 08b8400b41..a6ec6f08b0 100644 --- a/ProcessMaker/Jobs/RunScriptTask.php +++ b/ProcessMaker/Jobs/RunScriptTask.php @@ -41,7 +41,6 @@ class RunScriptTask extends BpmnAction implements ShouldQueue */ public function __construct(Definitions $definitions, ProcessRequest $instance, ProcessRequestToken $token, array $data, $attemptNum = 1) { - $this->onQueue('bpmn'); $this->definitionsId = $definitions->getKey(); $this->instanceId = $instance->getKey(); $this->tokenId = $token->getKey(); diff --git a/ProcessMaker/Jobs/RunServiceTask.php b/ProcessMaker/Jobs/RunServiceTask.php index 76ce0c9746..a4f6259ed6 100644 --- a/ProcessMaker/Jobs/RunServiceTask.php +++ b/ProcessMaker/Jobs/RunServiceTask.php @@ -36,9 +36,9 @@ class RunServiceTask extends BpmnAction implements ShouldQueue /** * Create a new job instance. * - * @param \ProcessMaker\Models\Process $definitions - * @param \ProcessMaker\Models\ProcessRequest $instance - * @param \ProcessMaker\Models\ProcessRequestToken $token + * @param Definitions $definitions + * @param ProcessRequest $instance + * @param ProcessRequestToken $token * @param array $data */ public function __construct(Definitions $definitions, ProcessRequest $instance, ProcessRequestToken $token, array $data, $attemptNum = 1) @@ -48,7 +48,6 @@ public function __construct(Definitions $definitions, ProcessRequest $instance, } else { $pmConfig = []; } - $this->onQueue($pmConfig['queue'] ?? 'bpmn'); $this->definitionsId = $definitions->getKey(); $this->instanceId = $instance->getKey(); $this->tokenId = $token->getKey(); diff --git a/ProcessMaker/Jobs/ThrowSignalEvent.php b/ProcessMaker/Jobs/ThrowSignalEvent.php index 2588c48a99..4d4739391d 100644 --- a/ProcessMaker/Jobs/ThrowSignalEvent.php +++ b/ProcessMaker/Jobs/ThrowSignalEvent.php @@ -73,7 +73,7 @@ public function handle() $chunk, $this->signalRef, $this->data - )->onQueue('bpmn'); + ); } } removeTemporalData($this->data_uid); diff --git a/ProcessMaker/Nayra/Managers/WorkflowManagerDefault.php b/ProcessMaker/Nayra/Managers/WorkflowManagerDefault.php index 0f757aa7e2..ebadbc5b65 100644 --- a/ProcessMaker/Nayra/Managers/WorkflowManagerDefault.php +++ b/ProcessMaker/Nayra/Managers/WorkflowManagerDefault.php @@ -188,7 +188,7 @@ public function runScripTask(ScriptTaskInterface $scriptTask, Token $token) Log::info('Dispatch a script task: ' . $scriptTask->getId() . ' #' . $token->getId()); $instance = $token->processRequest; $process = $instance->process; - RunScriptTask::dispatch($process, $instance, $token, [])->onQueue('bpmn'); + RunScriptTask::dispatch($process, $instance, $token, []); } /** @@ -266,7 +266,7 @@ public function throwSignalEventDefinition(EventDefinitionInterface $sourceEvent $excludeProcesses = [$token->getInstance()->getModel()->process_id]; $excludeRequests = $this->getCollaboratingInstanceIds($token->getInstance()); - ThrowSignalEvent::dispatch($signalRef, $data, $excludeProcesses, $excludeRequests)->onQueue('bpmn'); + ThrowSignalEvent::dispatch($signalRef, $data, $excludeProcesses, $excludeRequests); } /** @@ -298,7 +298,7 @@ protected function getCollaboratingInstanceIds($instance) */ public function throwSignalEvent($signalRef, array $data = [], array $exclude = []) { - ThrowSignalEvent::dispatch($signalRef, $data, $exclude)->onQueue('bpmn'); + ThrowSignalEvent::dispatch($signalRef, $data, $exclude); } /** @@ -314,7 +314,7 @@ public function throwSignalEventProcess($processId, $signalRef, array $data) $processId, $signalRef, $data - )->onQueue('bpmn'); + ); } /** @@ -341,7 +341,7 @@ public function throwSignalEventRequest(ProcessRequest $request, $signalRef, arr */ public function throwMessageEvent($instanceId, $elementId, $messageRef, array $payload = []) { - ThrowMessageEvent::dispatch($instanceId, $elementId, $messageRef, $payload)->onQueue('bpmn'); + ThrowMessageEvent::dispatch($instanceId, $elementId, $messageRef, $payload); } /** diff --git a/ProcessMaker/Nayra/Managers/WorkflowManagerRabbitMq.php b/ProcessMaker/Nayra/Managers/WorkflowManagerRabbitMq.php index d66d45d5aa..58c8d2b4ab 100644 --- a/ProcessMaker/Nayra/Managers/WorkflowManagerRabbitMq.php +++ b/ProcessMaker/Nayra/Managers/WorkflowManagerRabbitMq.php @@ -275,7 +275,7 @@ public function runServiceTask(ServiceTaskInterface $serviceTask, TokenInterface // Log execution Log::info('Dispatch a service task: ' . $serviceTask->getId()); - RunNayraServiceTask::dispatch($token)->onQueue('bpmn'); + RunNayraServiceTask::dispatch($token); } /** diff --git a/ProcessMaker/Nayra/Repositories/PersistenceHandler.php b/ProcessMaker/Nayra/Repositories/PersistenceHandler.php index 17d5c662be..f35d585cb7 100644 --- a/ProcessMaker/Nayra/Repositories/PersistenceHandler.php +++ b/ProcessMaker/Nayra/Repositories/PersistenceHandler.php @@ -152,7 +152,7 @@ public function save(array $transaction) $token = $this->deserializer->unserializeToken($transaction['token']); // Trigger script task executor - RunNayraScriptTask::dispatch($token)->onQueue('bpmn'); + RunNayraScriptTask::dispatch($token); break; default: throw new Exception('Unknown transaction type ' . $transaction['type']); diff --git a/ProcessMaker/Providers/RecommendationsServiceProvider.php b/ProcessMaker/Providers/RecommendationsServiceProvider.php index 1f85dbe91a..eb93830404 100644 --- a/ProcessMaker/Providers/RecommendationsServiceProvider.php +++ b/ProcessMaker/Providers/RecommendationsServiceProvider.php @@ -29,7 +29,7 @@ public function register(): void // Dispatch the job to the low-priority queue if (RecommendationEngine::shouldGenerateFor($processRequestToken->user)) { - GenerateUserRecommendations::dispatch($processRequestToken->user_id)->onQueue('low'); + GenerateUserRecommendations::dispatch($processRequestToken->user_id); } }); } diff --git a/ProcessMaker/Services/ScriptMicroserviceService.php b/ProcessMaker/Services/ScriptMicroserviceService.php index 8401388af6..b7df55102e 100644 --- a/ProcessMaker/Services/ScriptMicroserviceService.php +++ b/ProcessMaker/Services/ScriptMicroserviceService.php @@ -34,7 +34,7 @@ public function handle(Request $request) $instance = ProcessRequest::find($response['metadata']['script_task']['instance_id']); $token = ProcessRequestToken::find($response['metadata']['script_task']['token_id']); if ($response['status'] === 'success') { - CompleteActivity::dispatch($definitions, $instance, $token, $response['output'])->onQueue('bpmn'); + CompleteActivity::dispatch($definitions, $instance, $token, $response['output']); } } } diff --git a/upgrades/2022_04_19_164837_sanitize_usernames.php b/upgrades/2022_04_19_164837_sanitize_usernames.php index 5b409223d6..dee11868dd 100644 --- a/upgrades/2022_04_19_164837_sanitize_usernames.php +++ b/upgrades/2022_04_19_164837_sanitize_usernames.php @@ -25,7 +25,7 @@ class SanitizeUsernames extends Upgrade * * @return void * - * @throws \RuntimeException + * @throws RuntimeException */ public function preflightChecks() { @@ -39,14 +39,13 @@ public function preflightChecks() */ public function up() { - DB::table('users')->select(['id','username'])->orderBy('id')->chunk(250, + DB::table('users')->select(['id', 'username'])->orderBy('id')->chunk(250, static function ($users) { - dispatch(new SanitizeUsernamesJob($users))->onQueue('high'); + dispatch(new SanitizeUsernamesJob($users)); } ); } - /** * Reverse the upgrade migrations. * @@ -57,4 +56,3 @@ public function down() // } } -