Skip to content

[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

Closed
wants to merge 7 commits into from
Closed

[redis][poc] Add delay strategy #560

wants to merge 7 commits into from

Conversation

makasim
Copy link
Member

@makasim makasim commented Oct 16, 2018

fixes #553

@makasim makasim changed the title Add delay strategy [redis] Add delay strategy Oct 16, 2018
@makasim makasim changed the title [redis] Add delay strategy [redis][poc] Add delay strategy Oct 16, 2018
@@ -0,0 +1,26 @@
<?php

namespace Enqueue\RedisTools;
Copy link
Member Author

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);
Copy link
Member Author

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.

Copy link
Member Author

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
Copy link
Member Author

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) {
Copy link
Member Author

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

@makasim
Copy link
Member Author

makasim commented Oct 27, 2018

close in favor of #585

@makasim makasim closed this Oct 27, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants