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: sourcegraph/conc
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v0.3.0
Choose a base ref
...
head repository: sourcegraph/conc
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 19 commits
  • 29 files changed
  • 6 contributors

Commits on Feb 27, 2023

  1. Added successful case for context pool, returns before timeout (#94)

    I think we need an example of, if the tasks return before the context
    cancelled due to timeout, it should success
    
    Co-authored-by: Camden Cheek <[email protected]>
    zhongdai and camdencheek authored Feb 27, 2023
    Configuration menu
    Copy the full SHA
    ba7ce51 View commit details
    Browse the repository at this point in the history

Commits on Mar 3, 2023

  1. fix result_pool_test.go (#99)

    Fixes #98
    camdencheek authored Mar 3, 2023
    Configuration menu
    Copy the full SHA
    1d4991d View commit details
    Browse the repository at this point in the history

Commits on Apr 10, 2023

  1. Allow pools to be reusable (#108)

    Fixes #103. See inline comments for rationale.
    camdencheek authored Apr 10, 2023
    Configuration menu
    Copy the full SHA
    06d3061 View commit details
    Browse the repository at this point in the history

Commits on May 3, 2023

  1. always spawn a worker with the task it was supposed to complete (#112)

    For "unlimited" pools, in the original code:
    
    ```go
    p.handle.Go(p.worker)
    p.tasks <- f
    ```
    
    If in between the call to `handle.Go` and sending the task to the
    worker, another goroutine would call `pool.Go`, that task would "hijack"
    the newly created worker, causing the original send to block. This is
    undesirable behavior if the pool is unlimited.
    
    The solution was to add an `initialFunc` to the worker, which will be
    executed before the worker starts waiting for new tasks. This ensures
    that a worker will first complete the task it was supposed to, then
    complete others.
    Link512 authored May 3, 2023
    Configuration menu
    Copy the full SHA
    8e5ba59 View commit details
    Browse the repository at this point in the history

Commits on Jun 1, 2023

  1. Add WithFailFast() (#118)

    In #104, a "FailFast" option is
    likely going to be added to iterators that, on error, stops running
    additional tasks and returns the error that caused the first failure.
    
    "FailFast" seems is a pretty standard description for this behavior, and
    combining two common options into a single option with a more
    discoverable name seems like a nice thing to do before 1.0.
    camdencheek authored Jun 1, 2023
    Configuration menu
    Copy the full SHA
    995000d View commit details
    Browse the repository at this point in the history
  2. Add note about errors (#116)

    Clarifies questions in #101
    camdencheek authored Jun 1, 2023
    Configuration menu
    Copy the full SHA
    7a31dff View commit details
    Browse the repository at this point in the history

Commits on Jun 2, 2023

  1. Remove outdated TODO (#117)

    We use the new error facilities when built with go 1.20, so this TODO no
    longer applies.
    camdencheek authored Jun 2, 2023
    Configuration menu
    Copy the full SHA
    b3c39d3 View commit details
    Browse the repository at this point in the history

Commits on Nov 12, 2023

  1. Use *_test packages to make examples copy-pasteable (#124)

    The main reason for this PR was to make the examples in documentation
    copy-pasteable, but there are some additional benefits too.
    
    For example, the pool example before this change:
    
    ```go
    p := New().WithMaxGoroutines(3)
    for i := 0; i < 5; i++ {
    	p.Go(func() {
    		fmt.Println("conc")
    	})
    }
    p.Wait()
    ```
    
    and after:
    
    ```go
    p := pool.New().WithMaxGoroutines(3) // has package name
    for i := 0; i < 5; i++ {
    	p.Go(func() {
    		fmt.Println("conc")
    	})
    }
    p.Wait()
    ```
    kke authored Nov 12, 2023
    Configuration menu
    Copy the full SHA
    abd9a8b View commit details
    Browse the repository at this point in the history
  2. only execute stream callback when non-nil (#121)

    Currently, if `nil` is returned as a stream callback, it will cause a
    panic because we try to call a `nil` func. This makes it valid to return
    a `nil` callback from the stream job, which just does nothing on
    callback.
    Kimi.Wang authored and camdencheek committed Nov 12, 2023
    Configuration menu
    Copy the full SHA
    b528efd View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    b7b9417 View commit details
    Browse the repository at this point in the history
  4. remove obsolete build directives

    The `//go:build` directive was added in go 1.18, but this module
    requires at least go 1.19, so the old version of these build directives
    is unnecessary.
    camdencheek committed Nov 12, 2023
    Configuration menu
    Copy the full SHA
    a68c69f View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    30a99cd View commit details
    Browse the repository at this point in the history

Commits on Jan 8, 2024

  1. Multierror: join errors at the end (#132)

    This fixes `MapErr` so that it does not create recursive `joinError`s.
    By repeatedly calling `errors.Join(`, we create a nested set of
    `joinError`s rather than a single, flat `joinError`. Then, when
    `Error()` is called, it allocates a new string for each nested error
    because `joinError` calls `Error()` recursively on each of its children.
    
    Instead, this PR updates `MapErr` to just collect a slice of errors and
    return the flat joined error.
    camdencheek authored Jan 8, 2024
    Configuration menu
    Copy the full SHA
    4afefce View commit details
    Browse the repository at this point in the history

Commits on Jan 19, 2024

  1. Make result order deterministic (#126)

    This makes the order of results in a `Result.*Pool` deterministic so
    that the order of the result slice corresponds with the order of tasks
    submitted. As an example of why this would be useful, it makes it easy
    to rewrite `iter.Map` in terms of `ResultPool`. Additionally, it's a
    generally nice and intuitive property to be able to match the index of
    the result slice with the index of the input slice.
    camdencheek authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    8427ccd View commit details
    Browse the repository at this point in the history
  2. Reusable pools (#129)

    This updates the pool types that collect results and errors to reset on
    `Wait` so they are reusable once waited on. Previously, if a pool was
    reused, the returned values of `Wait()` would contain the aggregated set
    of all previous uses. This wasn't explicitly a guarantee of the library
    before, but it does make it operate more like `sync.WaitGroup` and it's
    easy to do, so I think it's a positive change.
    camdencheek authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    4c5c70a View commit details
    Browse the repository at this point in the history
  3. Exclusively use go1.20 multierrors (#127)

    This removes the dependency on `go.uber.org/multierror` in favor of
    the multierror functionality included in go 1.20.
    camdencheek authored Jan 19, 2024
    Configuration menu
    Copy the full SHA
    e454401 View commit details
    Browse the repository at this point in the history

Commits on Jan 21, 2024

  1. add Makefile and run benchmarks as part of PRs (#130)

    This:
    - Adds a Makefile with `make test` and `make lint` and `make bench`
    - Adds a new workflow for `main` that runs benchmarks and saves them
    - Adds a new workflow for PRs that runs benchmarks and compares against
    `main`. When a benchmark regression occurs, it should fail the workflow
    miparnisari authored Jan 21, 2024
    Configuration menu
    Copy the full SHA
    1124809 View commit details
    Browse the repository at this point in the history
  2. bump minimum go version

    camdencheek committed Jan 21, 2024
    Configuration menu
    Copy the full SHA
    a3ac5f2 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    5f936ab View commit details
    Browse the repository at this point in the history
Loading