-
Notifications
You must be signed in to change notification settings - Fork 444
[redis][poc] Add delay strategy #560
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
…in the bottom of the queue
@@ -0,0 +1,26 @@ | |||
<?php | |||
|
|||
namespace Enqueue\RedisTools; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think we need redis tool for now, the code could be in Enqueue\Redis
|
||
$targetTimestamp = time() + $delayMsec / 1000; | ||
|
||
$context->getRedis()->zadd('enqueue:'.$dest->getTopicName().':delayed', $targetTimestamp, $targetTimestamp); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the third argument should be a serialized message.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
and if we do so we can stop on this. no need to send a message to enqueue:{topic}:delayed:{timestamp}
collection.
use Interop\Queue\PsrConsumer; | ||
use Interop\Queue\PsrMessage; | ||
|
||
class RedisZSetDelayConsumer implements PsrConsumer |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the code could be moved to RedisZSetDelayStrategy
.
@@ -46,15 +65,21 @@ public function setDeliveryDelay($deliveryDelay) | |||
return; | |||
} | |||
|
|||
throw new \LogicException('Not implemented'); | |||
if (null === $this->delayStrategy) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
null === $this->delayStrategy && null !== $deliveryDelay
close in favor of #585 |
fixes #553