//Yes, we also decided not to use the package. We want to try use a task scheduling to run queue jobs with delay =)
//For example (command):
// run the job now
dispatch(new ExampleJob);
// and every 10 seconds this minute
for ($i = 1; $i <= 5; $i++ ) {
dispatch(new ExampleJob)->delay($i * 10);
}
public function destroy($id)
{
if (!ProjectPolicy::requestDelete($id)) {
return response()->json(Response::getErrorMessage('Ошибка доступа'), 403);
}
$project = Project::find($id);
if (!$project) {
return response()->json(Response::getErrorMessage('Проект не найден'), 404);
}
// это вот в сервис класс.
$project->delete();
$this->deleteImageProject($project->logo);
return response()->json(Response::getSuccessMessage('Вы успешно удалили проект'), 200);
}
$user = User::find($user_id);
$messagesQuery = Message::where('active', true);
if($message->referrer == true || ($message->referrer == false && $user->referrer_1_id == null)){
$messagesQuery->where(....);
}
$messages = $messagesQuery->get()
$userQuery = USER::query()
->where(active, '=', 1);
if($roleId){
$userQuery->join('roles', 'roles.user_id', '=', 'user_id')
->where('role', '=', $roleId);
}
$user = $userQuery->get()
'defaults' => [
'supervisor-1' => [
'connection' => 'redis',
'queue' => ['high','medium', 'low'],
'balance' => 'simple',
'minProcesses' => 1,
'maxProcesses' => 5,
'balanceMaxShift' => 1,
'balanceCooldown' => 3,
'tries' => 3,
'timeout' => 600,
],
'supervisor-2' => [
'connection' => 'redis',
'queue' => [
\App\Services\QueueService::QUEUE_NAME__MEDIA_LIBRARY,
],
'balance' => 'simple',
'minProcesses' => 1,
'maxProcesses' => 2,
'balanceMaxShift' => 1,
'balanceCooldown' => 3,
'tries' => 3,
'timeout' => 60,
],
'supervisor-3' => [
'connection' => 'redis',
'queue' => [
\App\Services\QueueService::QUEUE_NAME__IMPORT_WEBHOOK,
],
'balance' => 'simple',
'minProcesses' => 1,
'maxProcesses' => 2,
'balanceMaxShift' => 1,
'balanceCooldown' => 3,
'tries' => 3,
'timeout' => 1200,
],
],
'environments' => [
'production' => [
'supervisor-1' => [
'minProcesses' => 1,
'maxProcesses' => 5,
],
'supervisor-2' => [
'minProcesses' => 1,
'maxProcesses' => 2,
],
'supervisor-3' => [
'minProcesses' => 1,
'maxProcesses' => 2,
],
],
'staging' => [
'supervisor-1' => [
'minProcesses' => 1,
'maxProcesses' => 2,
],
'supervisor-2' => [
'minProcesses' => 1,
'maxProcesses' => 2,
],
'supervisor-3' => [
'minProcesses' => 1,
'maxProcesses' => 2,
],
],
'local' => [
'supervisor-1' => [
'minProcesses' => 1,
'maxProcesses' => 4,
],
'supervisor-2' => [
'minProcesses' => 1,
'maxProcesses' => 2,
],
'supervisor-3' => [
'minProcesses' => 1,
'maxProcesses' => 2,
],
],
],