So, the problem with the panic is that in the code (server.go
) there is a check for an error from the apns.Client
instance, but then there is a blind check on the result object which may be null:
if err != nil {
LogError(fmt.Sprintf("Failed to send apple push sid=%v did=%v err=%v", msg.ServerId, msg.DeviceId, err))
}
if !res.Sent() {
LogError(fmt.Sprintf("Failed to send apple push with res ApnsID=%v reason=%v code=%v", res.ApnsID, res.Reason, res.StatusCode))
}
This really should be an else if
or a check for a null res
value (or both). Also, once there is an error I think the apns.Client
instance is toast and should be recreated. Not positive on this, but it works for me right now and my proxy is no longer falling over when there is a lull in the notification traffic.