diff --git a/CHANGELOG.md b/CHANGELOG.md index 7ac48fb..03b7722 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,6 @@ +# 2.1.3 (2023-11-15) +- Resolved issue with SET EX TTL's using unix-timestamps + # 2.1.2 (2023-03-22) - Update composer packages - Update git information (GitHub) diff --git a/README.md b/README.md index 4c6ceb9..552717c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -php-resque: PHP Resque Worker (and Enqueue) +php-resque: PHP Background (Resque) Worker =========================================== Resque is a Redis-backed library for creating background jobs, placing @@ -53,19 +53,9 @@ Composer package inside your project. If you're not familiar with Composer, please see . -1. Add php-resque to your application's composer.json. +1. Run `composer require idanoo/php-resque`. -```json -{ - "require": { - "idanoo/php-resque": "^2.0" - } -} -``` - -2. Run `composer install`. - -3. If you haven't already, add the Composer autoload to your project's +2. If you haven't already, add the Composer autoload to your project's initialization file. (example) ```sh diff --git a/src/Resque/Job/Status.php b/src/Resque/Job/Status.php index 0486394..aaa29c3 100644 --- a/src/Resque/Job/Status.php +++ b/src/Resque/Job/Status.php @@ -62,7 +62,7 @@ class Status \Resque\Resque::redis()->set( 'job:' . $id . ':status', json_encode($statusPacket), - ['ex' => time() + 86400], + ['ex' => (86400 * 2)], ); } @@ -106,7 +106,7 @@ class Status \Resque\Resque::redis()->set( (string)$this, json_encode($statusPacket), - ['ex' => time() + 86400], + ['ex' => (86400 * 2)], ); } diff --git a/src/Resque/Stat.php b/src/Resque/Stat.php index 45bfe45..6592aa8 100644 --- a/src/Resque/Stat.php +++ b/src/Resque/Stat.php @@ -38,7 +38,7 @@ class Stat $set = Resque::redis()->set( 'stat:' . $stat, $by, - ['ex' => time() + 86400, 'nx'], + ['ex' => (86400 * 2), 'nx'], ); // If it already exists, return the incrby value diff --git a/src/Resque/Worker.php b/src/Resque/Worker.php index 6c19f13..a926364 100644 --- a/src/Resque/Worker.php +++ b/src/Resque/Worker.php @@ -486,15 +486,17 @@ class Worker /** * Register this worker in Redis. - * 48 hour TTL so we don't pollute the db on server termination. + * 48 hour TTL so we don't pollute the redis db on server termination. + * + * @return void */ - public function registerWorker() + public function registerWorker(): void { Resque::redis()->sadd('workers', (string)$this); Resque::redis()->set( 'worker:' . (string)$this . ':started', date('D M d H:i:s T Y'), - ['ex' => time() + 86400], + ['ex' => (86400 * 2)], ); } @@ -535,7 +537,7 @@ class Worker Resque::redis()->set( 'worker:' . $job->worker, $data, - ['ex' => time() + 86400], + ['ex' => (86400 * 2)], ); } diff --git a/tests/Resque/Tests/RedisTest.php b/tests/Resque/Tests/RedisTest.php index 200f208..5717bf6 100644 --- a/tests/Resque/Tests/RedisTest.php +++ b/tests/Resque/Tests/RedisTest.php @@ -17,7 +17,7 @@ class RedisTest extends TestCase $this->redis->set( 'testKey', 24, - ['ex' => time() + 3600], + ['ex' => 3600], ); $val = $this->redis->get("testKey");