parent
44bf37941b
commit
983aeeb33d
|
@ -52,7 +52,7 @@ type RequestPush struct {
|
||||||
|
|
||||||
// PushNotification is single notification request
|
// PushNotification is single notification request
|
||||||
type PushNotification struct {
|
type PushNotification struct {
|
||||||
ctx context.Context
|
Ctx context.Context
|
||||||
wg *sync.WaitGroup
|
wg *sync.WaitGroup
|
||||||
log *[]LogPushEntry
|
log *[]LogPushEntry
|
||||||
|
|
||||||
|
|
|
@ -22,7 +22,7 @@ func SendNotification(req PushNotification) {
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
case <-req.ctx.Done():
|
case <-req.Ctx.Done():
|
||||||
default:
|
default:
|
||||||
switch req.Platform {
|
switch req.Platform {
|
||||||
case PlatFormIos:
|
case PlatFormIos:
|
||||||
|
@ -72,7 +72,7 @@ func queueNotification(ctx context.Context, req RequestPush) (int, []LogPushEntr
|
||||||
|
|
||||||
log := make([]LogPushEntry, 0, count)
|
log := make([]LogPushEntry, 0, count)
|
||||||
for _, notification := range newNotification {
|
for _, notification := range newNotification {
|
||||||
notification.ctx = ctx
|
notification.Ctx = ctx
|
||||||
if PushConf.Core.Sync {
|
if PushConf.Core.Sync {
|
||||||
notification.wg = &wg
|
notification.wg = &wg
|
||||||
notification.log = &log
|
notification.log = &log
|
||||||
|
|
|
@ -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) {
|
func (s *Server) Send(ctx context.Context, in *proto.NotificationRequest) (*proto.NotificationReply, error) {
|
||||||
var badge = int(in.Badge)
|
var badge = int(in.Badge)
|
||||||
notification := gorush.PushNotification{
|
notification := gorush.PushNotification{
|
||||||
|
Ctx: ctx,
|
||||||
|
|
||||||
Platform: int(in.Platform),
|
Platform: int(in.Platform),
|
||||||
Tokens: in.Tokens,
|
Tokens: in.Tokens,
|
||||||
Message: in.Message,
|
Message: in.Message,
|
||||||
|
|
Loading…
Reference in New Issue