iqlas 0 Newbie Poster

Laravel App checks redis database for data pushed by 3rd Party.

Laravel Scheduler runs artisan command php artisan check:redis every 10 mins.

I am expecting about 20k records to be checked every hour at peak times. Please also suggest me if my whole approach as a whole is flawed.

  1. Scheduler runs check:redis command every 10 mins
  2. check:redis command should dispatch job to be queued
  3. Queue will later process jobs and create rows as required.

Below is handle() method from App\Console\Commands\CheckRedis

public function handle()
{
  while(Redis::llen('schema_queue')){
    dispatch(new CheckRedisJob($redis->rpop('schema_queue')))
  }
}

and this is App\Jobs\CheckRedisJob

public function handle()
{
    Stage::create([
        'model' => $this->entity->model,
        'payload' => json_encode($this->entity->payload)
    ]);
}

Now when I run the command, instead of queuing, it's directly creating what's in Stage::create()

Sidenote: Each job dispatched will have a Model name & payload and will be dynamically inserted to specified table by validating and/or checking as required which obviously takes time.(below is sample model/payload) That's where the whole idea of processing the Job Queue is.

{
  model : "Profession",
  payload: {
              id: '......',
              name: '........',
              contract_type: '........',
              employment_type: '........',
              department: '........'
              .... and like 20 other fields...

           }
}