Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Add a way to drop operation#4

Merged
elgopher merged 1 commit intomasterfrom
drop-backpressure
May 4, 2022
Merged

Add a way to drop operation#4
elgopher merged 1 commit intomasterfrom
drop-backpressure

Conversation

@elgopher
Copy link
Owner

@elgopher elgopher commented May 3, 2022

Client code executing Processor.Run might want to abort running operation if the operation was not yet run in a batch. Such situation is possible when there is a high request congestion.

From now on Processor.Run will accept new parameter context.Context. This context could be cancelled by the client effectively dropping the operation if it was still waiting to be run.

Example:

ctx := context.WithTimeout(context.Background(), 5 * time.Second)
err := processor.Run(ctx, "key", ...)
// err will be OperationCancelled

@elgopher elgopher force-pushed the drop-backpressure branch 3 times, most recently from 9277d22 to 6de5012 Compare May 4, 2022 10:02
@elgopher elgopher changed the title Add a way to drop operation (back-pressure) Add a way to drop operation May 4, 2022
@elgopher elgopher force-pushed the drop-backpressure branch 4 times, most recently from 94fb12c to d7c2b98 Compare May 4, 2022 11:30
Client code executing Processor.Run might want to abort running operation if the operation was not yet run in a batch. Such situation is possible when there is a high request congestion.

From now on Processor.Run will accept new parameter context.Context. This context could be cancelled by the client effectively dropping the operation if it was still waiting to be run.

Example:

```
ctx := context.WithTimeout(context.Background(), 5 * time.Second)
err := processor.Run(ctx, "key", ...)
// err will be OperationCancelled
```
@elgopher elgopher force-pushed the drop-backpressure branch from d7c2b98 to 4142325 Compare May 4, 2022 12:24
@elgopher elgopher merged commit 870ccfc into master May 4, 2022
@elgopher elgopher deleted the drop-backpressure branch May 4, 2022 15:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant