Skip to content

Commit

Permalink
Refine naming and callback interface (Cont2.)
Browse files Browse the repository at this point in the history
  • Loading branch information
steven.chiu committed Jun 10, 2019
1 parent 6f5627b commit 18b51a9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions test/SchedulerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ public function testScheduler()
}
$scheduler = new JobScheduler(0, $redisConf['host'], $redisConf['port'], $db, 15, 15, __DIR__."/../vendor/autoload.php");
self::addJob($redisConf, $result);
$scheduler->run(function ($keyArray, $value, $way) use ($result) {
$scheduler->run(function ($attrs, $value, $way) use ($result) {
$wayStr = $way == 0 ? 'polling' : 'notification';
$id = str_replace(JobManager::SCHEDULE_KEY_PREFIX, '', $key);
$id = join(':', $attrs);
$diff = time() - $result[$id];
if (self::DEBUG) {
echo "current: ".time()." expected: $result[$id] Diff time: $diff\n";
Expand Down
4 changes: 2 additions & 2 deletions test/job_test.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ function init($redisConf, $isJobSubmitter = false)
$scheduler->getLooper()->addPeriodicTimer(20, function () use ($redisConf) {
testAddJob($redisConf);
});
$scheduler->run(function ($keyArray, $value, $way) {
$scheduler->run(function ($attrs, $value, $way) {
$wayStr = $way == 0 ? 'polling' : 'notification';
echo "Job is ready: key: ".json_encode($keyArray)." value: $value [$wayStr]\n";
echo "Job is ready: key: ".json_encode($attrs)." value: $value [$wayStr]\n";
});
} catch (\RedisException $exception) {
echo "Exception:$exception\n";
Expand Down

0 comments on commit 18b51a9

Please sign in to comment.