When migrating some code to use connection pools, we discovered a confusing issue that caused pushes that were meant for the APNS production environment to be unexpectedly send to the development/sandbox environment.
After some digging, we determined that the issue was related to the .development method, as not using it would make the issue go away. We eventually determined that our because our configuration for the dev/prod connection pools via a module was using the same constant CONFIG as the basis for creating pooled connections, the call to merge! (mutating in-place) in development was causing any new connections in either pool to be created with the development URL by mistake.
When migrating some code to use connection pools, we discovered a confusing issue that caused pushes that were meant for the APNS production environment to be unexpectedly send to the development/sandbox environment.
After some digging, we determined that the issue was related to the
.development
method, as not using it would make the issue go away. We eventually determined that our because our configuration for the dev/prod connection pools via a module was using the same constantCONFIG
as the basis for creating pooled connections, the call tomerge!
(mutating in-place) indevelopment
was causing any new connections in either pool to be created with the development URL by mistake.Suggested Fix:
I believe the quickest fix here would be to change this line: https://github.com/ostinelli/apnotic/blob/master/lib/apnotic/connection.rb#L15 to look something like this:
I would be happy to submit a PR for that if that seems reasonable.
As a workaround, if anyone needs one temporarily:
Just use
Connection.new(
and passurl: 'https://api.sandbox.push.apple.com:443'
as part of the options, rather than use.development
Thanks!