Skip to content

Commit

Permalink
support concurrent access for Pool items
Browse files Browse the repository at this point in the history
  • Loading branch information
tim-smart committed May 28, 2024
1 parent a0f989d commit 6f61854
Show file tree
Hide file tree
Showing 4 changed files with 369 additions and 488 deletions.
5 changes: 5 additions & 0 deletions .changeset/quiet-maps-judge.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"effect": minor
---

support concurrent access for Pool items
17 changes: 11 additions & 6 deletions packages/effect/src/Pool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ export const make: <A, E, R>(
options: {
readonly acquire: Effect.Effect<A, E, R>
readonly size: number
readonly permits?: number | undefined
}
) => Effect.Effect<Pool<A, E>, never, Scope.Scope | R> = internal.make

Expand Down Expand Up @@ -115,12 +116,16 @@ export const make: <A, E, R>(
* @since 2.0.0
* @category constructors
*/
export const makeWithTTL: <A, E, R>(options: {
readonly acquire: Effect.Effect<A, E, R>
readonly min: number
readonly max: number
readonly timeToLive: Duration.DurationInput
}) => Effect.Effect<Pool<A, E>, never, Scope.Scope | R> = internal.makeWithTTL
export const makeWithTTL: <A, E, R>(
options: {
readonly acquire: Effect.Effect<A, E, R>
readonly min: number
readonly max: number
readonly permits?: number | undefined
readonly timeToLive: Duration.DurationInput
readonly strategy?: "creation" | "access" | undefined
}
) => Effect.Effect<Pool<A, E>, never, Scope.Scope | R> = internal.makeWithTTL

/**
* Retrieves an item from the pool in a scoped effect. Note that if
Expand Down
Loading

0 comments on commit 6f61854

Please sign in to comment.