Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Implement blockWhenExhausted

Open
#555 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
scala
Domain
backend

Research direction

Start by examining the pool's existing borrow/take operation and how Cats Effect cancellation and timeout are used. Compare the desired behavior with commons-pool2's blockWhenExhausted and the suggested tryTake: Resource[F, Option[Managed[F]]]. Done requires an agreed API and semantics for immediate failure versus bounded blocking, plus corresponding tests.

Written by the indexing model from the issue text.

Description

commons-pool2 parity

commons-pool2 functionality

In commons-pool2, borrowObject, when no object is available, it may immediately raise an error or block for a specified duration, depending on the blockWhenExhausted property.

Current behavior

keypool effectively hardcodes this to true with semantic blocking. The effect can be canceled, so the duration can be emulated with a simple Cats Effect timeout. There is not presently a way to immediately fail, similar to tryAcquire on a Semaphore.

Analysis

It is not clear why this should be a property on the pool rather than an operation on the caller. A tryTake: Resource[F, Option[Managed[F]] is a possibility.

Workarounds

timeout with a short enough duration to not introduce lag, but a long enough duration to not generate false positives.

Dominant language
Scala
Stars
39
Forks
18
Avg merge
8h 26m
Merged PRs (30d)
4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from typelevel/keypool

All issues in typelevel/keypool

Similar issues

More Scala issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.