public function getArguments() { $args = json_encode($this->job->getArguments()); $lockHash = $this->job->getClass() . ':' . $args; // Could SHA1 this or something, but it could be useful to read this value return array(Time::microtime(), (int) $this->lockType, $this->job->getId(), $this->job->getClass(), $args, $lockHash, Job::JOB_PENDING, $this->queueId); }
public function testDelayedJobIsPushedWithJobArguments() { \Phresque\Util\Time::$testing = 500; $this->queueMock->expects($this->once())->method('addTimedJob')->with($this->getJobExpectation(), \Phresque\Util\Time::microtime() + 10); $this->builder->job('TestJob')->with(array('args' => 1))->in(10)->to($this->queueMock); \Phresque\Util\Time::$testing = false; }
public function getArguments() { return array($this->hostId, Time::microtime()); }
public function isSleeping() { return Time::microtime() < $this->sleepUntil; }
public function getArguments() { return array($this->time ?: Time::microtime(), Job::JOB_PENDING); }
public function getArguments() { return array(Time::microtime(), Job::JOB_RUNNING, $this->error ? Job::JOB_FAILED : Job::JOB_SUCCEEDED, $this->error ? $this->error->getMessage() : '', (string) $this->error, $this->error ? 'failed' : 'succeeded'); }
public function getArguments() { return array(Time::microtime(), $this->hostId, $this->startHash, $this->saveJobDataDefault); }
public function getArguments() { return array(Time::microtime(), $this->jobId, $this->maxObjects, $this->removeObjectsMax, Job::JOB_FAILED, Job::JOB_SUCCEEDED); }
public function getArguments() { return array(Time::microtime()); }
public function search($page = 0, $limit = 200) { $end = $this->timeEnd ? $this->timeEnd->getTimestamp() : Time::microtime() + 1; $start = $this->timeStart ? $this->timeStart->getTimestamp() : 0; $args = array($start, $end, $page * $limit, $limit); $keys = $this->buildSearchKeys(); if (($keysCount = count($keys)) > 1) { $args[] = $keysCount; $keysString = "ARGV[5]"; foreach ($keys as $i => $k) { $keysString .= " ,KEYS[" . ($i + 2) . "]"; } $command = "redis.call('zinterstore', KEYS[1], {$keysString}, 'AGGREGATE', 'MAX')" . PHP_EOL; array_unshift($keys, 'searchtmp:' . uniqid(getmypid() . ':', true)); } else { $command = ""; count($keys) or $keys[0] = 'index:job:all'; } // zREVrangebyscore so ARG[2] ARG[1] are reversed $command .= "local result = redis.call('zrevrangebyscore', KEYS[1], ARGV[2], ARGV[1], 'LIMIT', ARGV[3], ARGV[4])" . PHP_EOL; $command .= "local count = redis.call('zcount', KEYS[1], ARGV[1], ARGV[2])" . PHP_EOL; if ($keysCount > 1) { $command .= "redis.call('del', KEYS[1])" . PHP_EOL; } $command .= 'return {count, result}'; list($count, $list) = $this->commandExecutor->execute(new Phresque\Redis\Commands\DynamicCommand($command, $keys, $args)); $jobs = array(); foreach ($list as $jobID) { $jobs[] = $this->commandExecutor->execute(new Phresque\Redis\Commands\GetJob($jobID)); } return $this->withCount ? array($jobs, $count) : $jobs; }
public function __construct($olderThan = null) { $this->olderThan = max($olderThan ? Time::microtime() - $olderThan : 0, 0); }
public function getArguments() { return array(Time::microtime(), Job::JOB_RUNNING, $this->hostId); }
/** * */ public function updateHostStatus() { if (Time::microtime() > $this->nextUpdateTime) { $this->logger->debug('Host: Memory usage: ' . memory_get_peak_usage()); $this->logger->debug('Host: Memory usage: ' . memory_get_usage()); $this->host->updateStatus() or $this->terminate(); $this->pause = $this->host->isPaused(); $this->host->isShutdown() and $this->shutdown(); $this->host->resolveScheduledJobs(); $this->host->resolveTimedJobs(); $this->host->saveTimeSeriesData(); $this->nextUpdateTime = Time::microtime() + 1; } }