-
-
Notifications
You must be signed in to change notification settings - Fork 151
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scheduled Job issue #82
Comments
Hi @ChrisCook1906, how does scheduled your jobs? All jobs are scheduled using the Laravel default logic (tenant not-aware). Have you implemented a logic that replaces the original one? Please post your code to help me to understand. Thanks |
I'm running the standard Scheduler function in App/Console/Kernel: The job, UpdateMatrix, has the proper TenantAware function implemented. All of my other queued jobs are working correctly, except for those dispatched via the Schedule function in (App/Console/Kernel). |
Ok, sorry for my questions but I'd like to understand: in your |
No. In the
|
@ChrisCook1906, I tried but seems that works like a charm. What am I wrong? // app/console/Kernel.php
protected function schedule(Schedule $schedule)
{
if (Tenant::current()) {
$schedule->job(TenantNoopJob::class)->everyMinute();
return;
}
$schedule->job(LandlordNoopJob::class)->everyMinute();
} //
// TenantNoopJob
class TenantNoopJob implements ShouldQueue, TenantAware
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info('TenantNoopJob - '. Tenant::current()->domain .' - '. now());
}
}
//
// LandlordNoopJob
class LandlordNoopJob implements ShouldQueue, NotTenantAware
{
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
public function handle()
{
Log::info('LandlordNoopJob - '. now());
}
} |
@ChrisCook1906, do you have found a solution to the issue? |
@masterix21 Yes. Thank you. |
Hi --
I have the package set up and things are working as expected....with the exception of my scheduled jobs.
I have queues enabled by default to be tenant aware:
'queues_are_tenant_aware_by_default' => true
I have the middleware added to app/http/kernel:
In App\Console\Kernel, I have a scheduled job:
$schedule->job(new UpdateMatrix())->everyFiveMinutes();
The job runs twice but only the main database updates.
In my cronjob (which executes the Scheduler) I have applied the tenants:artisan prefix.
For the UpdateMatrix job above, I have added TenantAware
class UpdateMatrix implements ShouldQueue, TenantAware..
What am I missing?
The text was updated successfully, but these errors were encountered: