Skip to content

feat(async): add withPermit method to Semaphore#7180

Open
aaronz0 wants to merge 1 commit into
denoland:mainfrom
aaronz0:main
Open

feat(async): add withPermit method to Semaphore#7180
aaronz0 wants to merge 1 commit into
denoland:mainfrom
aaronz0:main

Conversation

@aaronz0

@aaronz0 aaronz0 commented Jun 9, 2026

Copy link
Copy Markdown

This is a common API pattern found in many concurrency libraries. It provides a highly convenient way to return the result of a protected task directly as an expression, entirely removing the boilerplate of manual semaphore management.

Usage Example:

const sem = new Semaphore(2);
const result = await sem.withPermit(async () => {
  return "task completed";
});

@CLAassistant

CLAassistant commented Jun 9, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@github-actions github-actions Bot added the async label Jun 9, 2026
@codecov

codecov Bot commented Jun 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 94.56%. Comparing base (cdf74a8) to head (52fa022).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7180      +/-   ##
==========================================
- Coverage   94.57%   94.56%   -0.01%     
==========================================
  Files         636      637       +1     
  Lines       52142    52154      +12     
  Branches     9401     9401              
==========================================
+ Hits        49315    49322       +7     
- Misses       2249     2254       +5     
  Partials      578      578              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aaronz0 aaronz0 force-pushed the main branch 2 times, most recently from 1d7337c to ee72f45 Compare June 9, 2026 01:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants