@3-/pool

0.1.3 • Public • Published

@3-/pool

test/main.coffee :

#!/usr/bin/env coffee

> @3-/pool > Pool
  @3-/sleep:sleep

pool = Pool 5

job = (n)=>
  console.log n
  await sleep 100*n
  throw n
  console.log 'done\t',n

n = 0
pool.size = 2
while ++n<10
 await pool job,n

pool.size = 5
n = 0
while ++n<10
 await pool job,n

await pool.done

output :

./out.txt

About This Project

This project is an open-source component of i18n.site ⋅ Internationalization Solution.

关于本项目

本项目为 i18n.site ⋅ 国际化解决方案 的开源组件。

/@3-/pool/

    Package Sidebar

    Install

    npm i @3-/pool

    Weekly Downloads

    0

    Version

    0.1.3

    License

    Apache-2.0

    Unpacked Size

    3.28 kB

    Total Files

    3

    Last publish

    Collaborators

    • i18n-now