mehrdadep
mehrdadep

Reputation: 1019

Set laravel job's timeout based on some config

To set Laravel job's $timeout value we can use this code

public $timeout = 120;

Is there a way to set this value dynamically (via a method)? something like this

public function timeout(): int
{
    return config('general.some_config');
}

The above code does not seem to have any effect on the job's timeout value.

Upvotes: 0

Views: 410

Answers (1)

Mahmoud Akoubeh
Mahmoud Akoubeh

Reputation: 51

You can assign it by constructor in like this

public function __construct()
{
    $this->timeout = config('general.some_config');
}

Upvotes: 1

Related Questions