|
1 | 1 | import path from 'node:path'; |
2 | | -import Bluebird from 'bluebird'; |
3 | 2 | import stream from 'node:stream'; |
4 | 3 | import { TypedError } from 'typed-error'; |
5 | | -import * as rsync from './rsync'; |
6 | | -import * as btrfs from './btrfs'; |
7 | | -import { spawn } from './utils'; |
| 4 | +import * as rsync from './rsync.js'; |
| 5 | +import * as btrfs from './btrfs.js'; |
| 6 | +import { spawn } from './utils.js'; |
8 | 7 | import type Dockerode from 'dockerode'; |
9 | 8 | import * as dt from 'docker-toolbelt'; |
| 9 | +import pTimeout from 'p-timeout'; |
10 | 10 |
|
11 | 11 | const DELTA_OUT_OF_SYNC_CODES = [19, 23, 24]; |
12 | 12 |
|
@@ -139,16 +139,16 @@ async function applyBatch( |
139 | 139 | let p = stream.promises.pipeline(batch, rsyncProcess.stdin!); |
140 | 140 |
|
141 | 141 | if (timeout !== 0) { |
142 | | - p = Bluebird.resolve(p).timeout(timeout); |
| 142 | + p = pTimeout(p, { milliseconds: timeout }); |
143 | 143 | } |
144 | 144 |
|
145 | 145 | try { |
146 | 146 | await p; |
147 | 147 | log('Batch input stream ended; waiting for rsync...'); |
148 | 148 | try { |
149 | | - await Bluebird.resolve(rsyncProcess.waitAsync()).timeout( |
150 | | - RSYNC_EXIT_TIMEOUT, |
151 | | - ); |
| 149 | + await pTimeout(rsyncProcess.waitAsync(), { |
| 150 | + milliseconds: RSYNC_EXIT_TIMEOUT, |
| 151 | + }); |
152 | 152 | log('rsync exited cleanly'); |
153 | 153 | } catch (err) { |
154 | 154 | log(`Error waiting for rsync to exit: ${err}`); |
|
0 commit comments