-
Notifications
You must be signed in to change notification settings - Fork 133
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
RUMM-709 Upload delay increases in case of network error #249
RUMM-709 Upload delay increases in case of network error #249
Conversation
clientTokenError added: unlike clientError, it doesn't decrease interval
53e336f
to
da2e3f4
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👌, just one nit and convention. Let's fix and merge.
internal protocol Delay { | ||
func nextUploadDelay() -> TimeInterval | ||
mutating func decrease() | ||
mutating func increase() | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: the name, Delay
is domain-agnostic, but the nextUploadDelay()
has "upload" meaning. This
func next() -> TimeInterval
mutating func decrease()
mutating func increase()
would be more coherent IMO.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i didn't pay attention before but actually current
makes more sense than next
, wdyt?
} | ||
|
||
// swiftlint:disable multiline_arguments_brackets | ||
func test_whenThereIsNoBatch_thenIntervalIncreases() throws { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
52afb1b
to
b65dc0e
Compare
What and why?
SDK was decreasing upload interval as long as there is a batch to upload
That caused problems in case of network errors
Example case: the device can't resolve upload URL for some reason, yet SDK keeps trying to upload at short intervals.
How?
Now if there is a network error or client token error, interval increases (interval used to decrease in that case)
Review checklist