Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
miguelreiswildlife committed Dec 12, 2024
1 parent 6d5d471 commit e7898a5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 8 deletions.
2 changes: 1 addition & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ services:
retries: 10

kafka-ui:
image: docker.redpanda.com/vectorized/console:latest
image: docker.redpanda.com/redpandadata/console:latest
ports:
- 9000:8080
depends_on:
Expand Down
1 change: 0 additions & 1 deletion e2e/apns_e2e_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,6 @@ func (s *ApnsE2ETestSuite) TestConsumeMessagesBeforeExiting() {
}

func (s *ApnsE2ETestSuite) TestConsumeMessagesBeforeExitingWithRetries() {

app, p, mockApnsClient, statsdClientMock, responsesChannel := s.setupApnsPusher()
ctx := context.Background()
ctx, cancel := context.WithCancel(ctx)
Expand Down
11 changes: 9 additions & 2 deletions pusher/apns.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ package pusher
import (
"errors"
"fmt"
"slices"

"github.com/sirupsen/logrus"
"github.com/spf13/viper"
Expand Down Expand Up @@ -94,8 +95,14 @@ func (a *APNSPusher) configure(queue interfaces.APNSPushQueue, db interfaces.DB,
}

for _, a := range a.Config.GetApnsAppsArray() {
q.Topics = append(q.Topics, fmt.Sprintf("push-%s_apns-single", a))
q.Topics = append(q.Topics, fmt.Sprintf("push-%s_apns-massive", a))
singleTopic := fmt.Sprintf("push-%s_apns-single", a)
if !slices.Contains(q.Topics, singleTopic) {
q.Topics = append(q.Topics, singleTopic)
}
massiveTopic := fmt.Sprintf("push-%s_apns-massive", a)
if !slices.Contains(q.Topics, massiveTopic) {
q.Topics = append(q.Topics, massiveTopic)
}
}

a.MessageHandler = make(map[string]interfaces.MessageHandler)
Expand Down
14 changes: 10 additions & 4 deletions pusher/gcm.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,14 @@ package pusher
import (
"context"
"fmt"
"github.com/topfreegames/pusher/extensions/firebase/client"

"github.com/sirupsen/logrus"
"github.com/spf13/viper"
"github.com/topfreegames/pusher/config"
"github.com/topfreegames/pusher/extensions"
"github.com/topfreegames/pusher/extensions/firebase"
"github.com/topfreegames/pusher/extensions/firebase/client"
"github.com/topfreegames/pusher/interfaces"
"slices"
)

// GCMPusher struct for GCM pusher
Expand Down Expand Up @@ -82,8 +82,14 @@ func NewGCMPusher(
}
g.Queue = q
for _, a := range g.Config.GetGcmAppsArray() {
q.Topics = append(q.Topics, fmt.Sprintf("push-%s_gcm-single", a))
q.Topics = append(q.Topics, fmt.Sprintf("push-%s_gcm-massive", a))
singleTopic := fmt.Sprintf("push-%s_gcm-single", a)
if !slices.Contains(q.Topics, singleTopic) {
q.Topics = append(q.Topics, singleTopic)
}
massiveTopic := fmt.Sprintf("push-%s_gcm-massive", a)
if !slices.Contains(q.Topics, massiveTopic) {
q.Topics = append(q.Topics, massiveTopic)
}
}

err = g.createMessageHandlerForApps(ctx)
Expand Down

0 comments on commit e7898a5

Please sign in to comment.