Allow getStoriesById to fail in state resolution

This commit is contained in:
Ali
2023-07-27 21:57:47 +04:00
parent f3dd75276d
commit 2f73692d65
4 changed files with 40 additions and 27 deletions

View File

@@ -295,7 +295,7 @@ class Download: NSObject, MTRequestMessageServiceDelegate {
|> retryRequest
}
func request<T>(_ data: (FunctionDescription, Buffer, DeserializeFunctionResponse<T>), expectedResponseSize: Int32? = nil) -> Signal<T, MTRpcError> {
func request<T>(_ data: (FunctionDescription, Buffer, DeserializeFunctionResponse<T>), expectedResponseSize: Int32? = nil, automaticFloodWait: Bool = true) -> Signal<T, MTRpcError> {
return Signal { subscriber in
let request = MTRequest()
request.expectedResponseSize = expectedResponseSize ?? 0
@@ -311,6 +311,12 @@ class Download: NSObject, MTRequestMessageServiceDelegate {
request.needsTimeoutTimer = self.useRequestTimeoutTimers
request.shouldContinueExecutionWithErrorContext = { errorContext in
guard let errorContext = errorContext else {
return true
}
if errorContext.floodWaitSeconds > 0 && !automaticFloodWait {
return false
}
return true
}