2.1.3 (2023-11-15)

- Resolved issue with SET EX TTL's using unix-timestamps
This commit is contained in:
Daniel Mason 2023-11-15 09:52:10 +13:00
parent 0b925b68bd
commit 948b758a57
Signed by: idanoo
GPG Key ID: 387387CDBC02F132
6 changed files with 16 additions and 21 deletions

View File

@ -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) # 2.1.2 (2023-03-22)
- Update composer packages - Update composer packages
- Update git information (GitHub) - Update git information (GitHub)

View File

@ -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 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 <http://getcomposer.org/>. If you're not familiar with Composer, please see <http://getcomposer.org/>.
1. Add php-resque to your application's composer.json. 1. Run `composer require idanoo/php-resque`.
```json 2. If you haven't already, add the Composer autoload to your project's
{
"require": {
"idanoo/php-resque": "^2.0"
}
}
```
2. Run `composer install`.
3. If you haven't already, add the Composer autoload to your project's
initialization file. (example) initialization file. (example)
```sh ```sh

View File

@ -62,7 +62,7 @@ class Status
\Resque\Resque::redis()->set( \Resque\Resque::redis()->set(
'job:' . $id . ':status', 'job:' . $id . ':status',
json_encode($statusPacket), json_encode($statusPacket),
['ex' => time() + 86400], ['ex' => (86400 * 2)],
); );
} }
@ -106,7 +106,7 @@ class Status
\Resque\Resque::redis()->set( \Resque\Resque::redis()->set(
(string)$this, (string)$this,
json_encode($statusPacket), json_encode($statusPacket),
['ex' => time() + 86400], ['ex' => (86400 * 2)],
); );
} }

View File

@ -38,7 +38,7 @@ class Stat
$set = Resque::redis()->set( $set = Resque::redis()->set(
'stat:' . $stat, 'stat:' . $stat,
$by, $by,
['ex' => time() + 86400, 'nx'], ['ex' => (86400 * 2), 'nx'],
); );
// If it already exists, return the incrby value // If it already exists, return the incrby value

View File

@ -486,15 +486,17 @@ class Worker
/** /**
* Register this worker in Redis. * 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()->sadd('workers', (string)$this);
Resque::redis()->set( Resque::redis()->set(
'worker:' . (string)$this . ':started', 'worker:' . (string)$this . ':started',
date('D M d H:i:s T Y'), date('D M d H:i:s T Y'),
['ex' => time() + 86400], ['ex' => (86400 * 2)],
); );
} }
@ -535,7 +537,7 @@ class Worker
Resque::redis()->set( Resque::redis()->set(
'worker:' . $job->worker, 'worker:' . $job->worker,
$data, $data,
['ex' => time() + 86400], ['ex' => (86400 * 2)],
); );
} }

View File

@ -17,7 +17,7 @@ class RedisTest extends TestCase
$this->redis->set( $this->redis->set(
'testKey', 'testKey',
24, 24,
['ex' => time() + 3600], ['ex' => 3600],
); );
$val = $this->redis->get("testKey"); $val = $this->redis->get("testKey");