Skip to content

Commit

Permalink
feat: 逐步替换bluebird
Browse files Browse the repository at this point in the history
  • Loading branch information
bangbang93 committed Jan 25, 2024
1 parent 37a815f commit 6e59920
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
17 changes: 17 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
"lodash-es": "^4.17.21",
"morgan": "^1.9.1",
"ms": "^2.1.2",
"p-map": "^7.0.1",
"progress": "^2.0.3",
"socket.io-client": "^4.5.1",
"tail": "^2.2.6"
Expand Down
3 changes: 2 additions & 1 deletion src/cluster.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {clone, min, sum, template} from 'lodash-es'
import morgan from 'morgan'
import ms from 'ms'
import {tmpdir} from 'os'
import pMap from 'p-map'
import {dirname, join, sep} from 'path'
import {cwd} from 'process'
import ProgressBar from 'progress'
Expand Down Expand Up @@ -120,7 +121,7 @@ export class Cluster {
})
const parallel = parseInt(process.env.SYNC_PARALLEL ?? '1', 10) || 1
const noopen = process.env.FORCE_NOOPEN === 'true' && parallel === 1 ? '1' : ''
await Bluebird.map(missingFiles, async (file, i) => {
await pMap(missingFiles, async (file, i) => {
const path = join(this.cacheDir, file.hash.substring(0, 2), file.hash)
if (process.stderr.isTTY) {
bar.interrupt(`${colors.green('downloading')} ${colors.underline(file.path)}`)
Expand Down

0 comments on commit 6e59920

Please sign in to comment.