Skip to content

Commit

Permalink
chore(notifications): fix build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
peterbitfly committed Sep 10, 2024
1 parent 4467399 commit 13780b3
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion backend/pkg/commons/types/frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (
"strings"
"time"

"firebase.google.com/go/messaging"
"firebase.google.com/go/v4/messaging"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common/hexutil"
"github.com/gobitfly/beaconchain/pkg/commons/log"
Expand Down
10 changes: 5 additions & 5 deletions backend/pkg/notification/firebase.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strings"
"time"

"firebase.google.com/go/messaging"
firebase "firebase.google.com/go/v4"
"firebase.google.com/go/v4/messaging"
"github.com/gobitfly/beaconchain/pkg/commons/log"
"github.com/gobitfly/beaconchain/pkg/commons/utils"
"google.golang.org/api/option"
Expand Down Expand Up @@ -78,9 +78,9 @@ func SendPushBatch(messages []*messaging.Message, dryRun bool) error {
newMessages := make([]*messaging.Message, 0, result.FailureCount)
if result.FailureCount > 0 {
for i, response := range result.Responses {
logger.Info(response)
log.Info(response)
if isRelevantError(response) {
logger.Infof("retrying message %d", i)
log.Infof("retrying message %d", i)
newMessages = append(newMessages, currentMessages[i])
resultFailureCount--
}
Expand All @@ -96,12 +96,12 @@ func SendPushBatch(messages []*messaging.Message, dryRun bool) error {
if len(currentMessages) > 0 {
for _, response := range result.Responses {
if isRelevantError(response) {
logger.WithError(response.Error).WithField("MessageID", response.MessageID).Errorf("firebase error")
log.Error(fmt.Errorf("firebase error, message id: %d, error: %s", response.MessageID, response.Error), "error sending push notifications", 0)

Check failure on line 99 in backend/pkg/notification/firebase.go

View workflow job for this annotation

GitHub Actions / lint

printf: fmt.Errorf format %d has arg response.MessageID of wrong type string (govet)
resultFailureCount++
}
}
}

logger.Infof("sent %d firebase notifications in %d of %d tries. successful: %d | failed: %d", len(messages), tries, len(waitBeforeTryInSeconds), resultSuccessCount, resultFailureCount)
log.Infof("sent %d firebase notifications in %d of %d tries. successful: %d | failed: %d", len(messages), tries, len(waitBeforeTryInSeconds), resultSuccessCount, resultFailureCount)
return nil
}
2 changes: 1 addition & 1 deletion backend/pkg/notification/notifications.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import (
"time"

gcp_bigtable "cloud.google.com/go/bigtable"
"firebase.google.com/go/messaging"
"firebase.google.com/go/v4/messaging"
"github.com/ethereum/go-ethereum/common"
"github.com/gobitfly/beaconchain/pkg/commons/cache"
"github.com/gobitfly/beaconchain/pkg/commons/db"
Expand Down

0 comments on commit 13780b3

Please sign in to comment.