superwall / Superwall-iOS

Remotely configure every aspect of your paywall and double your revenue.
https://superwall.com
MIT License
89 stars 24 forks source link

[BUG] 1000000000 seconds instead of 1 second? #136

Closed tkafka closed 1 year ago

tkafka commented 1 year ago

Potential error I noticed:

let oneSecond = TimeInterval(1_000_000_000)

I think this should be TimeInterval(1), as TimeInterval is specified in seconds, right?

https://github.com/superwall-me/Superwall-iOS/blob/aaf3d6ed793978d3248b469c19f6f4cb948b90cb/Sources/SuperwallKit/Network/Custom%20URL%20Session/TaskRetryLogic.swift#LL23C34-L23C34

tkafka commented 1 year ago

Aha, the delay returned is expected to be in nanoseconds: https://github.com/superwall-me/Superwall-iOS/blob/05b04f6beb57c78b1fda5dd3f3e39d0fe15c12cc/Sources/SuperwallKit/Misc/Extensions/Task%2BRetrying.swift#L23

So, this does the right thing, but it definitely confused, would be better to use eg. Double instead of TimeInterval then (and I also like to name the methods or variables with the unit to make it clear :)).

yusuftor commented 1 year ago

Yeah TimeInterval is just a typealias for double. There's no issue here although maybe it'd be better to have a Nanosecond typealias instead for clarity.