Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

shutdown with timeout closes socket immediately and waits after #24

Closed
flozano opened this issue Nov 19, 2013 · 2 comments
Closed

shutdown with timeout closes socket immediately and waits after #24

flozano opened this issue Nov 19, 2013 · 2 comments
Milestone

Comments

@flozano
Copy link

flozano commented Nov 19, 2013

While testing pushy, I am doing (simplified version):

pushManager.start();
pushManager.enqueuePushNotification(notification);
List<ApnsPushNotification> unsent = pushManager.shutdown(3000);

I know this is not the right way to use it and that I should keep the pushManager started for much longer. I'm just testing how shutdown with timeout behaves, and it looks like a weird behavior to me:

[2013-11-19 09:08:05,252] [DEBUG] [SQSEventListener-447537958] [] [] SimplePushManagerProvider:100 Starting pushManager
[2013-11-19 09:08:05,271] [DEBUG] [SQSEventListener-447537958] [] [] SimplePushManagerProvider:103 Started pushManager
[2013-11-19 09:08:05,272] [DEBUG] [SQSEventListener-447537958] [] [] PushyAPNSSendServiceImpl:116 Sending push notification (token=f44edf678a36a3e145e0eeb489925d996aacabeefb9f6e078f0299009b515583, payload={"aps":{},"whatever":"blabla"})
[2013-11-19 09:08:05,274] [DEBUG] [SQSEventListener-447537958] [] [] SimplePushManagerProvider:57 Stopping pushManager
[2013-11-19 09:08:05,472] [DEBUG] [pool-1-thread-3] [] [] APNSMockServer:145 EOF received while reading command
[2013-11-19 09:08:05,472] [INFO] [pool-1-thread-3] [] [] APNSMockServer:241 Closing socket...
[2013-11-19 09:08:07,675] [DEBUG] [SQSEventListener-447537958] [] [] SimplePushManagerProvider:62 Stopped pushManager (unsent=[SimpleApnsPushNotification [token=f44edf678a36a3e145e0eeb489925d996aacabeefb9f6e078f0299009b515583, payload={"aps":{},"whatever":"blabla"}, expiration=null]])

I would expect it to have enough time in 3 seconds to drain the buffer, given that it contains just one notification...

@flozano
Copy link
Author

flozano commented Nov 19, 2013

After seeing the code, I think my expectations for shutdown with timeout don't match the implementation :)

@flozano
Copy link
Author

flozano commented Nov 19, 2013

What about a drainAndShutdown(long timeout) which blocks accepting new notifications and only drains the current buffer ones?
See tentative impl in #25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants