Closed GoogleCodeExporter closed 8 years ago
Hey, nevermind, it was a case of closing the service before the connection was
even
open. Sorry for the fake issue.
Original comment by mutchin...@gmail.com
on 1 Jun 2010 at 11:59
No worries.
Original comment by jond...@gmail.com
on 2 Jun 2010 at 2:30
I have this issue also... calling service.Close(); does not wait for any queued
notifications to be sent. This appears to only happen on the FIRST send of the
application.
I've had to move service.Close(); to service_NotificationSuccess, although this
doesn't really make sense if multiple messages are being sent.
To replicate: change the loop in JdSoft.Apple.Apns.Test.Program to
for (int i = 1; i <= 1; i++)
Comment the following line:
System.Threading.Thread.Sleep(sleepBetweenNotifications);
Original comment by krtr...@gmail.com
on 18 Jun 2010 at 8:35
To me, it appears a "correct" fix can be added in
JdSoft.Apple.Apns.Notifications.NotificationConnection on line 280.
Current code:
Thread.Sleep(250);
Fix:
while (notifications.Count > 0)
{
Thread.Sleep(250);
}
A helpful comment on that line says
// 250 ms should be ample time for the loop to dequeue any remaining
notifications
It appears 250ms might be marginally too small an amount, on average my system
is taking 500 ms to dequeue the notifications, thought this loop should take
care of it.
Original comment by krtr...@gmail.com
on 18 Jun 2010 at 8:51
I've changed the code to:
int slept = 0;
int maxSleep = 10000; //10 seconds
while (notifications.Count > 0 && slept++ <= maxSleep)
Thread.Sleep(100);
This should be a safe way to wait until all are dequeued
Original comment by jond...@gmail.com
on 21 Jun 2010 at 3:58
Looks like a good check, though I believe maxSleep should be divided by 100
since the thread is sleeping (if the desired max is 10000ms).
int slept = 0;
int maxSleep = 10000; //10 seconds
while (notifications.Count > 0 && slept++ <= (maxSleep / 100))
Thread.Sleep(100);
Original comment by krtr...@gmail.com
on 21 Jun 2010 at 4:45
Ahh yes, thanks for catching that...
Original comment by jond...@gmail.com
on 21 Jun 2010 at 4:48
Thank you, it helps me too. I receive nothing when I try only one
notification... after following your instructions it works fine!
Original comment by nes...@ingens-networks.com
on 27 Aug 2010 at 8:53
Original issue reported on code.google.com by
mutchin...@gmail.com
on 1 Jun 2010 at 11:52