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

Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: elgopher/batch
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.2.1
Choose a base ref
...
head repository: elgopher/batch
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v0.3.0
Choose a head ref
  • 2 commits
  • 11 files changed
  • 1 contributor

Commits on May 4, 2022

  1. Add a way to drop operation

    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 committed May 4, 2022
    Configuration menu
    Copy the full SHA
    870ccfc View commit details
    Browse the repository at this point in the history

Commits on May 5, 2022

  1. Increase throughput

    Current implementation is not optimal. It is using fixed-size go-routines pool. If the pool specified by the user is too small, one slow resource could block processing of other resources (different keys, but same hash). User can adjust the pool size, but it is very hard to figure out this number upfront (before running the app on production).
    
    The new implementation spawn a dedicated go-routine for each new batch. At max one go-routine is created for given resource key. Go-routine is destroyed once batch ends.
    elgopher committed May 5, 2022
    Configuration menu
    Copy the full SHA
    a90382b View commit details
    Browse the repository at this point in the history
Loading