Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PushSharp Push doesn't process queue until stop

PushSharp only processes the queue when stop is called. Does anyone have an idea how often push sharp will process the queue or flush it? I don't want to have to call stop and start every time I want to send a notification to conserve resources.

            pushService = new PushService();
            pushService.StartApplePushService(new ApplePushChannelSettings(prod,  cert.InputStream.ReadToEnd(), passConfig.Value));
  pushService.QueueNotification(
                NotificationFactory.Apple().ForDeviceToken("mydeviceid").WithAlert("Notifications Started!").WithSound("default").WithBadge(7));


            pushService.StopAllServices(true);
like image 787
chrislhardin Avatar asked Apr 08 '26 22:04

chrislhardin


1 Answers

I'm a complete and utter idiot...

The main thread was completing execution before the queue timer could process the notification. StopAllServices forced the thread to wait... Maybe this will help someone else.

like image 53
chrislhardin Avatar answered Apr 11 '26 12:04

chrislhardin



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!