Skip to content

Commit

Permalink
#446 fix context (#484)
Browse files Browse the repository at this point in the history
  • Loading branch information
Romanenko Alexey authored Mar 13, 2020
1 parent 44bf379 commit 983aeeb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion gorush/notification.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ type RequestPush struct {

// PushNotification is single notification request
type PushNotification struct {
ctx context.Context
Ctx context.Context
wg *sync.WaitGroup
log *[]LogPushEntry

Expand Down
4 changes: 2 additions & 2 deletions gorush/worker.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ func SendNotification(req PushNotification) {
}

select {
case <-req.ctx.Done():
case <-req.Ctx.Done():
default:
switch req.Platform {
case PlatFormIos:
Expand Down Expand Up @@ -72,7 +72,7 @@ func queueNotification(ctx context.Context, req RequestPush) (int, []LogPushEntr

log := make([]LogPushEntry, 0, count)
for _, notification := range newNotification {
notification.ctx = ctx
notification.Ctx = ctx
if PushConf.Core.Sync {
notification.wg = &wg
notification.log = &log
Expand Down
2 changes: 2 additions & 0 deletions rpc/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ func (s *Server) Check(ctx context.Context, in *proto.HealthCheckRequest) (*prot
func (s *Server) Send(ctx context.Context, in *proto.NotificationRequest) (*proto.NotificationReply, error) {
var badge = int(in.Badge)
notification := gorush.PushNotification{
Ctx: ctx,

Platform: int(in.Platform),
Tokens: in.Tokens,
Message: in.Message,
Expand Down

0 comments on commit 983aeeb

Please sign in to comment.