Skip to content

How to prevent sending request after an error occurred? #712

Open
@kosukeohmura

Description

@kosukeohmura

Question Checklist

Question Subject

version: 1.0.0-alpha.9

I use gRPC Swift for developing an iOS app. When I call unary RPC under flight mode, I get a deadlineExceeded error but server receives the Unary request that should not be sent.

Would anyone tell me how to prevent sending request after I've got a call error, please?

Question Description

Process to reproduce:

  • make connection and client:
let eventLoopGroup = MultiThreadedEventLoopGroup(numberOfThreads: 1)
let connectionConfig = ClientConnection.Configuration(target: .hostAndPort("example.com", 443), eventLoopGroup: eventLoopGroup)
let connection = ClientConnection(configuration: connectionConfig)
let service = MyServiceClient(connection: connection)
  • turn on flight mode
  • request Unary gRPC call and wait for the result:
let call = service.postSomething(MyRequest("✈️")) // UnaryCall
let callResultEventLoop = call.status.and(call.trailingMetadata).and(call.response)
callResultEventLoop.whenSuccess { _ in
    print("Got a response.")
}
callResultEventLoop.whenFailure { error in
    print("Got an error: \(error)")
}
  • get an error log like below because it is under flight mode:
Got an error: deadlineExceeded (4): RPC timed out (timeout=10S) before completing
  • turn off flight mode
  • Unfortunately but server receives "✈️"

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind/bugFeature doesn't work as expected.kind/supportAdopter support requests.version/v1Relates to v1

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions