Closed Shkryob closed 4 years ago
I'm currently working on somewhat of a rewrite, I might be able to help you out.
What would you like to change about the behavior?
I'm currently working on somewhat of a rewrite, I might be able to help you out.
What would you like to change about the behavior?
I want to ignore "Failed to get jobStatusId" exceptions because I don't always want to track jobs.
I think something like this should work for you:
trait App\Traits\Trackable
{
use Imtigger\LaravelJobStatus\Trackable {
getJobStatusId as traitGetJobStatusId;
};
public function getJobStatusId()
{
return $this->statusId;
}
}
So if I understand you correctly you have a single job class that you only want to track in certain instances?
@crashkonijn Yes, your code works but it will send extra DB requests trying to update job_status with ID = null.
Perhaps something like this?
class TrackableJob extends NonTrackableJob
{
use Trackable;
public function __construct()
{
$this->prepareStatus();
}
}
class NonTrackableJob
{
public function handle()
{
// do your thing
}
}
I will think about a better option to disable tracking
I would like to extend LaravelJobStatusServiceProvider because I want to handle errors differently but updateJobStatus method is private and I have to copy whole class instead of redefine single method. Can we make it protected?