Skip to content
This repository was archived by the owner on May 7, 2024. It is now read-only.
This repository was archived by the owner on May 7, 2024. It is now read-only.

AwaitCancellation usage in FullStockTickerService #6

Open
@davidkarlsson

Description

@davidkarlsson

In the FullStockTickerService example that uses bidirectional streaming it feels to me like the use of the AwaitCancellation() method that creates a task that completes when the CancellationToken of the ServerCallContext is cancelled is unneccesary and has just been caried over from the example with the single stream without much thought.

Why not just await the HandleActions() method directly there since its task also completes when the same CancellationToken is cancelled?

Furthermore, if an exception is thrown in the HandleActions() method for some reason in a more complex example it will not cancel the CancellationToken and the program will stop reading new actions but the program will not stop because it will continue waiting for the token to be cancelled at the call to AwaitCancellation(). This seems rather dangerous to me in a real world scenario.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions