Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
New feature for retrying request after failed #26
base: develop
Are you sure you want to change the base?
New feature for retrying request after failed #26
Changes from 2 commits
17bcb45
605ea5e
5ce3964
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
naming invalid.
onGetDelay
called as callback, but it not "callback" - it behavior function. i suggestdelayGetter: (lastDelayInMillisecond: Long, timeRetrying: Int) -> Long
naming.for
onConditionRetrying
-isShouldRetryRequest(e: Throwable): Boolean
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.
strange logic. we send request without headers, but later we send request with headers one time and if it failed - we not catch again...do you debug this logic?
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.
In final this headers not send in a futher phase after
HttpSendPipeline.Before
. Logic:if request failed then I'm fininishing current request(all pipeline) and create new request (new pipeline(requestPipeline->sendPipeline)) adding info in headers when new request(retryed) come in the
HttpSendPipeline.Before
phase then I get info from headers and I delete these headers then send to next phase.If counter more or equel maxAmountsRetrying, I send to next phase like common request, that could throw a not handled exception(in this feature).
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.
confused logic in code...support of this will be pain - we should rework it to more clear version. @Tetraquark will help you
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.
for what we finish pipeline? later called proceed
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.
When finish a pipeline without a calling of proceedWith the ktor throw error:
java.lang.IllegalStateException: Failed to execute send pipeline. Expected to got [HttpClientCall], but received EmptyContent at io.ktor.client.features.HttpSend$DefaultSender.execute(HttpSend.kt:120) at io.ktor.client.features.HttpSend$DefaultSender$execute$1.invokeSuspend(Unknown Source:12) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(PipelineContext.kt:238) at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:194) at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(PipelineContext.kt:67) at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(PipelineContext.kt:144) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(PipelineContext.kt:238) at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:194) at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(PipelineContext.kt:67) at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(PipelineContext.kt:144) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(PipelineContext.kt:238) at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:194) at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(PipelineContext.kt:67) at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(PipelineContext.kt:144) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(PipelineContext.kt:238) at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:194) at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(PipelineContext.kt:67) at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(PipelineContext.kt:144) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(PipelineContext.kt:238) at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:194) at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(PipelineContext.kt:67) at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(PipelineContext.kt:144) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) at io.ktor.util.pipeline.SuspendFunctionGun.resumeRootWith(PipelineContext.kt:238) at io.ktor.util.pipeline.SuspendFunctionGun.loop(PipelineContext.kt:194) at io.ktor.util.pipeline.SuspendFunctionGun.access$loop(PipelineContext.kt:67) at io.ktor.util.pipeline.SuspendFunctionGun$continuation$1.resumeWith(PipelineContext.kt:144) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:46) at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:56) at android.os.Handler.handleCallback(Handler.java:883) at android.os.Handler.dispatchMessage(Handler.java:100) at android.os.Looper.loop(Looper.java:214) at android.app.ActivityThread.main(ActivityThread.java:7403) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:492) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:935)
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.
why this chaged?
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.
Because it replace two operation(maybe more, search->get->delete-->add) to one(rewrite | write) => mini performance)
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.
it was added because we have case when multiple tokens was sent
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.
be5ac65
#17