Process all jobs in the queue.

@return void
333976
public function process()
    {
        foreach ($this->jobs as $id => $job) {
            // get the job name
            $name = ucfirst($job['type']);
            // process the job
            $this->{"process{$name}"}($job);
            // remove it from the processing queue
            unset($this->jobs[$id]);
        }
    }
392752
protected function executeNextJob(): void
    {
        while ($this->jobs) {
            $job = \array_pop($this->jobs);
            
            if ($job->state & AbstractPromise::PENDING) {
                $done = false;
                
                (new Coroutine($job->context, $job->generator))->when(function (?\Throwable $e, $v = null) use ($job, & $done) {
                    if ($e) {
                        $job->fail($e);
                    } else {
                        $job->resolve($v);
                    }
                    
                    if ($done) {
                        $this->executeNextJob();
                    } else {
                        $done = true;
                    }
                });
                
                if (!$done) {
                    $done = true;
                    
                    return;
                }
            }
        }
        
        $this->running--;
    }
112869
protected function job(): void
    {
        while (true) {

            $medals = $this->retrieve([
                'corporation_id' => $this->getCorporationId(),
            ]);

            if ($medals->isCachedLoad()) return;

            collect($medals)->each(function ($medal) {

                CorporationIssuedMedal::firstOrNew([
                    'corporation_id' => $this->getCorporationId(),
                    'medal_id'       => $medal->medal_id,
                    'character_id'   => $medal->character_id,
                ])->fill([
                    'reason'    => $medal->reason,
                    'status'    => $medal->status,
                    'issuer_id' => $medal->issuer_id,
                    'issued_at' => carbon($medal->issued_at),
                ])->save();

            });

            if (! $this->nextPage($medals->pages))
                break;
        }
    }
221435
public function process()
    {
        parent::process();

        foreach ($this->children as $child) {
            if ($child !== null && !$child->isProcessed()) {
                $child->process();
            }
        }
    }
917201
protected function job(): void
    {
        $facilities = $this->retrieve([
            'corporation_id' => $this->getCorporationId(),
        ]);

        if ($facilities->isCachedLoad()) return;

        collect($facilities)->each(function ($facility) {

            CorporationFacility::firstOrNew([
                'corporation_id' => $this->getCorporationId(),
                'facility_id'    => $facility->facility_id,
            ])->fill([
                'type_id'   => $facility->type_id,
                'system_id' => $facility->system_id,
            ])->save();
        });

        CorporationFacility::where('corporation_id', $this->getCorporationId())
            ->whereNotIn('facility_id', collect($facilities)->pluck('facility_id')->all())
            ->delete();
    }
422690
public function scheduleWork()
    {
        if (is_null($this->scheduler)) {
            return;
        }

        $this->scheduler->reconnect();

        foreach ($this->scheduler->getJobsFor(new \DateTime()) as $job) {
            $this->pipeline->enqueue($job);
        }
    }
1032261
public function process()
    {
        // Run the UpdatePackageInfo task
        $updateTask = Injector::inst()->create(UpdatePackageInfoTask::class);
        $updateTask->run(null);

        // mark job as completed
        $this->isComplete = true;
    }
241590
protected function job(): void
    {
        $roles = $this->retrieve([
            'corporation_id' => $this->getCorporationId(),
        ]);

        if ($roles->isCachedLoad()) return;

        collect($roles)->each(function ($role) {

            collect($this->types)->each(function ($type) use ($role) {

                if (! property_exists($role, $type))
                    return;

                collect($role->{$type})->each(function ($name) use ($role, $type) {

                    CorporationRole::firstOrCreate([
                        'corporation_id' => $this->getCorporationId(),
                        'character_id'   => $role->character_id,
                        'type'           => $type,
                        'role'           => $name,
                    ]);

                });

                CorporationRole::where('corporation_id', $this->getCorporationId())
                    ->where('character_id', $role->character_id)
                    ->where('type', $type)
                    ->whereNotIn('role', collect($role->{$type})->flatten()->all())
                    ->delete();
            });
        });
    }
217440
public function run()
    {
        if ($this->count()) {

            $request = server_request();

            foreach ($this->registry as $offset => $handler) {
                $this->process($request, $handler);
            }
        }
    }
84741
protected function job(): void
    {
        while (true) {

            $customs_offices = $this->retrieve([
                'corporation_id' => $this->getCorporationId(),
            ]);

            if ($customs_offices->isCachedLoad()) return;

            collect($customs_offices)->each(function ($customs_office) {

                CorporationCustomsOffice::firstOrNew([
                    'corporation_id' => $this->getCorporationId(),
                    'office_id'      => $customs_office->office_id,
                ])->fill([
                    'system_id'                   => $customs_office->system_id,
                    'reinforce_exit_start'        => $customs_office->reinforce_exit_start,
                    'reinforce_exit_end'          => $customs_office->reinforce_exit_end,
                    'corporation_tax_rate'        => $customs_office->corporation_tax_rate ?? null,
                    'allow_alliance_access'       => $customs_office->allow_alliance_access,
                    'alliance_tax_rate'           => $customs_office->alliance_tax_rate ?? null,
                    'allow_access_with_standings' => $customs_office->allow_access_with_standings,
                    'standing_level'              => $customs_office->standing_level ?? null,
                    'excellent_standing_tax_rate' => $customs_office->excellent_standing_tax_rate ?? null,
                    'good_standing_tax_rate'      => $customs_office->good_standing_tax_rate ?? null,
                    'neutral_standing_tax_rate'   => $customs_office->neutral_standing_tax_rate ?? null,
                    'bad_standing_tax_rate'       => $customs_office->bad_standing_tax_rate ?? null,
                    'terrible_standing_tax_rate'  => $customs_office->terrible_standing_tax_rate ?? null,
                ])->save();

                $this->known_structures->push($customs_office->office_id);

            });

            if (! $this->nextPage($customs_offices->pages))
                break;
        }

        // Cleanup customs offices that were not in the response.
        CorporationCustomsOffice::where('corporation_id', $this->getCorporationId())
            ->whereNotIn('office_id', $this->known_structures->flatten()->all())
            ->delete();
    }
824716
public function doneWorking()
    {
        $this->currentJob = null;
        $this->working = false;
        $this->resqueInstance->stats->incr('processed');
        $this->resqueInstance->stats->incr('processed:' . (string)$this);
        $this->resqueInstance->redis->del($this->workerName() . ':' . (string)$this);
    }
183936
protected function process() {
        if($this->limited) {
            if(\microtime(true) < $this->resetTime) {
                $this->client->addTimer(($this->resetTime - \microtime(true)), function () {
                    $this->process();
                });
                
                return;
            }
            
            $this->limited = false;
            $this->remaining = ($this->limit ? $this->limit : \INF);
        }
        
        if(\count($this->queue) === 0) {
            return;
        }
        
        $item = \array_shift($this->queue);
        $this->processItem($item);
    }
400932
protected function job(): void
    {
        while (true) {

            $logs = $this->retrieve([
                'corporation_id' => $this->getCorporationId(),
            ]);

            if ($logs->isCachedLoad()) return;

            collect($logs)->each(function ($log) {

                CorporationContainerLog::firstOrNew([
                    'corporation_id' => $this->getCorporationId(),
                    'container_id'   => $log->container_id,
                    'logged_at'      => carbon($log->logged_at),
                ])->fill([
                    'container_type_id'  => $log->container_type_id,
                    'character_id'       => $log->character_id,
                    'location_id'        => $log->location_id,
                    'action'             => $log->action,
                    'location_flag'      => $log->location_flag,
                    'password_type'      => $log->password_type ?? null,
                    'type_id'            => $log->type_id ?? null,
                    'quantity'           => $log->quantity ?? null,
                    'old_config_bitmask' => $log->old_config_bitmask ?? null,
                    'new_config_bitmask' => $log->new_config_bitmask ?? null,
                ])->save();

            });

            if (! $this->nextPage($logs->pages))
                break;
        }
    }
165640
protected function main(): void
    {
        $this->logger->info('start job listener', [
            'category' => get_class($this),
        ]);

        $cursor_jobs = $this->jobs->getCursor([
            '$or' => [
                ['status' => JobInterface::STATUS_WAITING],
                ['status' => JobInterface::STATUS_POSTPONED],
            ],
        ]);

        $cursor_events = $this->events->getCursor([
            'timestamp' => ['$gte' => new UTCDateTime()],
            'job' => ['$exists' => true],
            'status' => ['$gt' => JobInterface::STATUS_POSTPONED],
        ]);

        $this->catchSignal();

        while ($this->loop()) {
            while ($this->loop()) {
                if (null === $cursor_events->current()) {
                    if ($cursor_events->getInnerIterator()->isDead()) {
                        $this->logger->error('event queue cursor is dead, is it a capped collection?', [
                            'category' => get_class($this),
                        ]);

                        $this->events->create();

                        $this->main();

                        break;
                    }

                    $this->events->next($cursor_events, function () {
                        $this->main();
                    });
                }

                $event = $cursor_events->current();
                $this->events->next($cursor_events, function () {
                    $this->main();
                });

                if($event === null) {
                    break;
                }

                $this->handleEvent($event);
            }

            if (null === $cursor_jobs->current()) {
                if ($cursor_jobs->getInnerIterator()->isDead()) {
                    $this->logger->error('job queue cursor is dead, is it a capped collection?', [
                        'category' => get_class($this),
                    ]);

                    $this->jobs->create();
                    $this->main();

                    break;
                }

                $this->jobs->next($cursor_jobs, function () {
                    $this->main();
                });

                continue;
            }

            $job = $cursor_jobs->current();

            $this->jobs->next($cursor_jobs, function () {
                $this->main();
            });

            $this->handleJob($job);
        }
    }
330020
public function process()
    {
        for ($i = $this->io->inReadQueue(); $i > 0; $i--) {
            $this->eventsProducer->parseLine($this->io->pop());
        }
    }
661535
public function process()
    {
        $this->initializeStorageNode($this->storageNodeNodePath, $this->storageNodeTitle);
        $this->initializeNodeTemplates();

        $nodeTemplate = new NodeTemplate();
        $this->processBatch($nodeTemplate);
    }
198087
public function process()
    {
        $this->data = array_values($this->data);

        if (isset($this->data[0])) {
            $data = $this->data;
        } else {
            $data = [$this->data];
        }

        foreach ($data as $key => $value) {
            $model = $this->fill($key, collect($value));
            $this->collection->push($model);
        }

        return $this->collection;
    }