Skip to content
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

Better control on delayed execution of messages #41

Open
anaspk opened this issue Sep 10, 2020 · 0 comments
Open

Better control on delayed execution of messages #41

anaspk opened this issue Sep 10, 2020 · 0 comments

Comments

@anaspk
Copy link

anaspk commented Sep 10, 2020

Hi @kainxspirits ,

First of all, thanks a lot for sharing this Pubsub driver for Laravel Queues. It definitely saved me a decent amount of time since I didn't have to implement it myself.

I was looking at how the delayed messages are handled. I found here that when available_at attribute is set in future for a message, we just return immediately without acknowledging it. As a result, message gets picked again by worker after the ack deadline set on the pubsub subscription is passed. In my case, I have set the ack deadline on my pubsub subscription to the max allowed value i.e. 600s. Now I want to be able to execute messages with any custom delay value within this range like 10s, 1m, 2m etc. Current implementation doesn't allow this.

However, it is possible to do this as following:

  1. When available_at > time() , get the remaining seconds like remaining_time = available_at - time()
  2. Modify ack deadline of this specific message to be remaining_time.
  3. Now as soon as remaining_time has passed, Pubsub subscription will make this message available again, overriding the ack deadline set on the subscription itself.

I am going to submit a PR with this implementation. Please let me know if this sounds like a valid general use case and if you would like to merge it in?

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

No branches or pull requests

1 participant