gorush icon indicating copy to clipboard operation
gorush copied to clipboard

The Redis queue engine doesn't work properly

Open dancb10 opened this issue 9 months ago • 1 comments

Hello, I don't know if this is by design (which makes no sense) but seems like when you use a Redis queue, ALL notifications pushed to the Redis queue are processed by all pods which means that you cannot scale beyond 1 pod else all notifications will be duplicated. So basically this is useless since the setup is not scalable. what is the purpose of using a redis queue with a single consumer? how do you scale gorush then?

kubectl port-forward svc/gorush 8888:80

curl -X POST \
     -H "Content-Type: application/json" \
     -d '{
  "notifications": [
    {
      "tokens": [
        "TOKEN"
      ],
      "platform": 2,
      "title": "Test Title",
      "message": "Test Message"
    }
  ]
}' http://127.0.0.1:8888/api/push
curl: (52) Empty reply from server

Two pods behind the service which both process and send the same notification thus duplicating it. As you scale the number of pods so are the duplicated notifications:

POD 1
7:35PM INF Request body_size=37 ip=127.0.0.1 latency=0.884048 method=POST path=/api/push status=200 user_agent=curl/8.7.1
{"level":"debug","msg":"Start push notification for Android","time":"2025-03-06T19:35:48Z"}
{"level":"debug","msg":"Android Success count: 1, Failure count: 0","time":"2025-03-06T19:35:48Z"}
{"level":"info","msg":"| succeeded-push | android [**********CUR_UFFF72p3:APA91bFNZTJVO1NRmebYiE-2Qh3tMVzthAgFc-**********] Test Message","time":"2025-03-06T19:35:48Z"}

POD2
{"level":"debug","msg":"Start push notification for Android","time":"2025-03-06T19:35:48Z"}
{"level":"debug","msg":"Android Success count: 1, Failure count: 0","time":"2025-03-06T19:35:48Z"}
{"level":"info","msg":"| succeeded-push | android [**********CUR_UFFF72p3:APA91bFNZTJVO1NRmebYiE-2Qh3tMVz**********] Test Message","time":"2025-03-06T19:35:48Z"}

dancb10 avatar Mar 06 '25 19:03 dancb10

I will take it.

appleboy avatar Mar 09 '25 14:03 appleboy

any updates?

alikhanz avatar Oct 28 '25 10:10 alikhanz

Please upgrade to https://github.com/appleboy/gorush/releases/tag/v1.19.1

appleboy avatar Oct 29 '25 14:10 appleboy

This issue hasn't been fixed, it's still there in 1.19.1

dancb10 avatar Nov 03 '25 13:11 dancb10