Show processing time in worker

This commit is contained in:
Frederic Guillot 2016-12-26 21:49:53 -05:00
parent 431b8341be
commit 9b4892e3ca

View File

@ -14,13 +14,16 @@ $connection = new Pheanstalk(BEANSTALKD_HOST);
while ($job = $connection->reserveFromTube(BEANSTALKD_QUEUE)) { while ($job = $connection->reserveFromTube(BEANSTALKD_QUEUE)) {
$payload = unserialize($job->getData()); $payload = unserialize($job->getData());
$start_time = microtime(true);
echo 'Processing feed_id=', $payload['feed_id'], ' for user_id=', $payload['user_id'],PHP_EOL; echo 'Processing feed_id=', $payload['feed_id'], ' for user_id=', $payload['user_id'];
Handler\Feed\update_feed($payload['user_id'], $payload['feed_id']); Handler\Feed\update_feed($payload['user_id'], $payload['feed_id']);
Model\Item\autoflush_read($payload['user_id']); Model\Item\autoflush_read($payload['user_id']);
Model\Item\autoflush_unread($payload['user_id']); Model\Item\autoflush_unread($payload['user_id']);
Miniflux\Helper\write_debug_file();
echo ', duration='.(microtime(true) - $start_time).' seconds', PHP_EOL;
Miniflux\Helper\write_debug_file();
$connection->delete($job); $connection->delete($job);
} }