force queue
This commit is contained in:
parent
33ae86a539
commit
4c056a4db4
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
namespace Blomstra\Search\Commands;
|
||||
|
||||
use Blomstra\Search\Jobs\Job;
|
||||
use Blomstra\Search\Jobs\SavingJob;
|
||||
use Blomstra\Search\Seeders\Seeder;
|
||||
use Elasticsearch\Client;
|
||||
|
|
@ -80,7 +81,7 @@ class BuildCommand extends Command
|
|||
$query->where('id', '<=', $id);
|
||||
})
|
||||
->chunk(50, function (Collection $collection) use ($queue, &$total, $seeder) {
|
||||
$queue->push(new SavingJob($collection, $seeder));
|
||||
$queue->pushOn(Job::$onQueue, new SavingJob($collection, $seeder));
|
||||
|
||||
$this->info("Pushed into the index, type: {$seeder->type()}, amount: {$collection->count()}.");
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@
|
|||
namespace Blomstra\Search;
|
||||
|
||||
use Blomstra\Search\Jobs\DeletingJob;
|
||||
use Blomstra\Search\Jobs\Job;
|
||||
use Blomstra\Search\Jobs\SavingJob;
|
||||
use Blomstra\Search\Seeders;
|
||||
use Elasticsearch\Client;
|
||||
|
|
@ -63,11 +64,11 @@ class Provider extends AbstractServiceProvider
|
|||
/** @var string|Seeders\Seeder $seeder */
|
||||
foreach ($seeders as $seeder) {
|
||||
$seeder::savingOn($events, function ($model) use ($queue, $seeder) {
|
||||
$queue->push(new SavingJob(Collection::make([$model]), $seeder));
|
||||
$queue->pushOn(Job::$onQueue, new SavingJob(Collection::make([$model]), $seeder));
|
||||
});
|
||||
|
||||
$seeder::deletingOn($events, function ($model) use ($queue, $seeder) {
|
||||
$queue->push(new DeletingJob(Collection::make([$model]), $seeder));
|
||||
$queue->pushOn(Job::$onQueue, new DeletingJob(Collection::make([$model]), $seeder));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue