Skip to content

Commit

Permalink
update spider
Browse files Browse the repository at this point in the history
  • Loading branch information
jjsty1e committed May 20, 2018
1 parent 9dccead commit b0df2a3
Showing 1 changed file with 2 additions and 10 deletions.
12 changes: 2 additions & 10 deletions src/AppBundle/Command/QueueRunCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,25 +97,17 @@ public function runJobQueue()
$redisJob = $redis->lpop('spider:job-queue');

if (!$redisJob) {
sleep(5);
$this->io->success('[任务队列] 当前没有任务任务!');
sleep(3);
continue;
}

$jobData = json_decode($redisJob, true);

$spiderId = $jobData['spiderId'];
$link = $jobData['link'];

$job = $jobRepository->findOneBy(['spiderId' => $spiderId, 'link' => $link]);

if ($job) {
continue;
}

$job = $jobRepository->createJob($jobData['spiderId'], $jobData['link']);
$spiderService->refreshRedisWaitingJobs($spiderId, $job->getId());

sleep(1);
}
}

Expand Down

0 comments on commit b0df2a3

Please sign in to comment.