gatewayd
gatewayd copied to clipboard
feat: use golang-queue to run async actions
Ticket(s)
#464
Description
This PR aims to add queue for async action using golang-queue project.
This is in draft mode right now as it is not finished. I plan to do the following steps to call it done.
- [x] use an internal golang-queue to queue and run async actions (already done)
- [ ] make an
act.Queuemodule as a wrapper around golang-queue which is configurable to either use internal or external (redis?) queue. - [ ] create a new command that can be configured to listen to a external queue to run async actions (maybe part of #472 and not this one?)
@mostafa to give an update, I'm working on this PR, but I have faced a problem with golang-queue project when using a redis. I think it is a bug on their but I'm not yet 100% sure. Trying to figure out better and see if I can fix it. Just wanted to give an update on why it's taking longer than I anticipated
What exactly is the problem? I know a thing or two about Redis.
If you try the example code in golang-queue project for redis pub/sub (here), it does not work either.
The problem is in this line of that project https://github.com/golang-queue/redisdb/blob/9c16bbdd242b9461b5b730201af064cd21a27f7f/redis.go#L155
A decoding error happens when reading data back from redis, but it is ignored. Later on the code encounters an index out of range error because of it. I don't think the problem is about redis (or maybe it is, if pub/sub adds some metadata or overhead to the message which should be expected or skipped while decoding?)
I guess I'll create an issue on their repo while also looking more into it to see if I can find out why that happens.
@Hamsajj Definitely a serialization issue. I can (also) look into the library in the afternoon if you want.
Based on our discussion, we decided to abandon using golang-queue for now and implement a lightweight and simple support for using Redis pub/sub as a queue for async actions