Closed taylortrimble closed 1 year ago
Yikes! Sorry about that. I'll have a look at it – it may take a few days since I'm currently on my honeymoon :smile:
Wow! Congratulations! :wedding:
Don't even think about fixing it on your honeymoon! I want to see gray squares on your GH profile every day you're gone! :wink:
@bdotdub Congrats.
I hope somebody at timehop can look at the pull requests I've been sending. I'm vendoring a copy with godep, but it still would be nice to push things upstream (and get some feedback if I'm doing it wrong).
@nathany Hey Nathan – sorry about that! I'll take a look at them soon. My github notifs are a mess so they got lost in the middle of everything else.
@tylrtrmbl Personally I'm validating the tokens before sending them to timehop APNS.
func isDeviceTokenValid(s string) bool {
if len(s) != 64 {
return false
}
_, err := hex.DecodeString(s)
return err == nil
}
The reason you didn't see an error is because it's currently ignoring errors from ToBinary. See client.go:180.
What I think should happen, is to move ToBinary sooner in the process so that Send()
can return an error.
@nathany I'd buy that. Instead of having Client
read off of a channel of Notification
, it should read a channel of []byte
. It'll isolate the possible errors to _, err = c.Conn.Write(b)
Sounds good.
I may be able to take a stab at it, but I'd like to resolve the current open pull requests first. Thanks!
I think it is a lot clearer what's going on if you have a channel of Notification
; what I'd recommend instead is removing the logging you have now in the run loop, and replacing it with an error channel on the client.
That way I can handle the error any way I see fit; log it to Sentry, for example.
Ignore my last message, I haven't seen the code in a while and I think I was wrong...
I just spent a long time tracking down a bug where I was passing a byte slice for the device identifier instead of a hex encoded string. I took an awfully long time, since I didn't have an error come out of
Client.FailedNotifs
.We should do that. :blush: