diff --git a/services/gateway/bun.lockb b/services/gateway/bun.lockb index aa27d227..e3baae83 100755 Binary files a/services/gateway/bun.lockb and b/services/gateway/bun.lockb differ diff --git a/services/gateway/package.json b/services/gateway/package.json index 5d41975a..ca7b579c 100644 --- a/services/gateway/package.json +++ b/services/gateway/package.json @@ -60,13 +60,13 @@ }, "license": "UNLICENSE", "dependencies": { - "@aws-sdk/client-s3": "^3.714.0", - "@aws-sdk/s3-request-presigner": "^3.714.0", + "@aws-sdk/client-s3": "^3.715.0", + "@aws-sdk/s3-request-presigner": "^3.715.0", "@axiomhq/pino": "^1.3.1", "@bitpatty/imgproxy-url-builder": "^1.7.0", "@elastic/elasticsearch": "^8.17.0", - "@envelop/disable-introspection": "^4.0.6", - "@faker-js/faker": "^8.4.1", + "@envelop/disable-introspection": "^6.0.0", + "@faker-js/faker": "^9.3.0", "@hono/node-server": "^1.13.7", "@inquirer/prompts": "^1.0.1", "@knpwrs/envariant": "^1.1.1", @@ -80,21 +80,21 @@ "@pothos/plugin-tracing": "^0.5.8", "@pothos/plugin-validation": "^3.10.1", "@prisma/client": "^5.22.0", - "@sentry/node": "^7.75.0", + "@sentry/node": "^8.47.0", "@sindresorhus/slugify": "^2.2.1", "@temporalio/activity": "^1.11.5", "@temporalio/client": "^1.11.5", "@temporalio/worker": "^1.11.5", "@temporalio/workflow": "^1.11.5", - "@zxcvbn-ts/core": "^2.2.1", - "@zxcvbn-ts/language-common": "^2.0.1", - "@zxcvbn-ts/language-en": "^2.1.0", + "@zxcvbn-ts/core": "^3.0.4", + "@zxcvbn-ts/language-common": "^3.0.4", + "@zxcvbn-ts/language-en": "^3.0.2", "argon2": "^0.41.1", "blurhash": "^2.0.5", - "camelcase-keys": "^8.0.2", + "camelcase-keys": "^9.1.3", "countries-list": "^3.1.1", - "dot-prop": "^7.2.0", - "execa": "^7.0.0", + "dot-prop": "^9.0.0", + "execa": "^9.5.2", "expiry-map": "^2.0.0", "fast-glob": "^3.3.2", "graphql-parse-resolve-info": "^4.13.0", @@ -106,37 +106,37 @@ "it-all": "^3.0.6", "it-filter": "^3.1.1", "jest-diff": "^29.7.0", - "jose": "^4.13.1", + "jose": "^5.9.6", "lexorank": "^1.0.5", "libphonenumber-js": "^1.11.17", "lodash-es": "^4.17.21", "m3u8-parser": "^7.2.0", - "mime": "^3.0.0", + "mime": "^4.0.6", "mjml": "^4.15.3", - "mkdirp": "^2.1.5", - "nanoid": "^4.0.2", + "mkdirp": "^3.0.1", + "nanoid": "^5.0.9", "nodemailer": "^6.9.16", - "ora": "^6.3.1", - "p-all": "^4.0.0", - "p-filter": "^3.0.0", - "p-lazy": "^4.0.0", - "p-map": "^5.5.0", + "ora": "^8.1.1", + "p-all": "^5.0.0", + "p-filter": "^4.1.0", + "p-lazy": "^5.0.0", + "p-map": "^7.0.3", "p-memoize": "^7.1.1", "p-one": "^2.0.0", - "p-queue": "^7.3.4", - "p-retry": "^5.1.2", + "p-queue": "^8.0.1", + "p-retry": "^6.2.1", "picocolors": "^1.1.1", - "pino": "^8.15.3", - "pino-pretty": "^10.2.0", + "pino": "^9.5.0", + "pino-pretty": "^13.0.0", "proper-tags": "^2.0.2", - "rimraf": "^4.3.1", + "rimraf": "^6.0.1", "sanitize-filename": "^1.6.3", "sharp": "^0.33.5", - "short-uuid": "^4.2.2", + "short-uuid": "^5.2.0", "subtitle": "^4.2.1", "tiny-invariant": "^1.3.3", - "uuid": "^9.0.0", - "wait-on": "^7.0.1", + "uuid": "^11.0.3", + "wait-on": "^8.0.1", "xss": "^1.0.15", "zod": "^3.24.1" }, @@ -146,15 +146,12 @@ "@types/bun": "^1.1.14", "@types/html-minifier": "^4.0.5", "@types/lodash-es": "^4.17.12", - "@types/mime": "^3.0.1", + "@types/mime": "^4.0.0", "@types/mjml": "^4.7.4", - "@types/mkdirp": "^1.0.2", "@types/node": "^22.10.2", "@types/nodemailer": "^6.4.17", "@types/request-ip": "^0.0.41", - "@types/rimraf": "^3.0.2", "@types/sharp": "^0.32.0", - "@types/uuid": "^9.0.1", "@types/wait-on": "^5.3.4", "@typescript-eslint/eslint-plugin": "^6.7.3", "@typescript-eslint/parser": "^6.7.3", diff --git a/services/gateway/src/temporal/activities/background/process-image.ts b/services/gateway/src/temporal/activities/background/process-image.ts index 2179a152..65b1f65b 100644 --- a/services/gateway/src/temporal/activities/background/process-image.ts +++ b/services/gateway/src/temporal/activities/background/process-image.ts @@ -1,8 +1,8 @@ import { join } from 'node:path'; import { Context } from '@temporalio/activity'; -import mkdirp from 'mkdirp'; +import { mkdirp } from 'mkdirp'; import mime from 'mime'; -import rimraf from 'rimraf'; +import { rimraf } from 'rimraf'; import { nanoid } from 'nanoid'; import { retryablePutFile, streamObjectToFile } from '../../../util/s3'; import { @@ -57,7 +57,7 @@ export default async function processImage( key: `${s3UploadKey}.imagemagick.json`, contentType: 'application/json', body: Buffer.from(JSON.stringify(json, null, 2)), - signal: Context.current().cancellationSignal, + cancelSignal: Context.current().cancellationSignal, }); if (json.format === 'JPEG') { @@ -79,7 +79,7 @@ export default async function processImage( key: path, contentType: json.mimeType, path: downloadPath, - signal: Context.current().cancellationSignal, + cancelSignal: Context.current().cancellationSignal, }); Context.current().heartbeat(); diff --git a/services/gateway/src/temporal/activities/background/restitch-transcript.ts b/services/gateway/src/temporal/activities/background/restitch-transcript.ts index f3afccc1..f76d315e 100644 --- a/services/gateway/src/temporal/activities/background/restitch-transcript.ts +++ b/services/gateway/src/temporal/activities/background/restitch-transcript.ts @@ -41,7 +41,7 @@ export default async function restitchTranscript(uploadRecordId: string) { contentType: 'text/vtt', body: fixedVtt, contentLength: fixedVtt.length, - signal: Context.current().cancellationSignal, + cancelSignal: Context.current().cancellationSignal, }); activityLogger.info(`done uploading transcript.vtt`); diff --git a/services/gateway/src/temporal/activities/import/import-media.ts b/services/gateway/src/temporal/activities/import/import-media.ts index 84060a6a..3f689b7e 100644 --- a/services/gateway/src/temporal/activities/import/import-media.ts +++ b/services/gateway/src/temporal/activities/import/import-media.ts @@ -2,13 +2,13 @@ import { createWriteStream } from 'node:fs'; import { basename, extname, join } from 'node:path'; import { pipeline } from 'node:stream/promises'; import { execa } from 'execa'; -import rimraf from 'rimraf'; +import { rimraf } from 'rimraf'; import { z } from 'zod'; import { v4 as uuid } from 'uuid'; import mime from 'mime'; import fastGlob from 'fast-glob'; import invariant from 'tiny-invariant'; -import mkdirp from 'mkdirp'; +import { mkdirp } from 'mkdirp'; import { noop } from 'lodash-es'; import { Context } from '@temporalio/activity'; import type { Prisma } from '@prisma/client'; diff --git a/services/gateway/src/temporal/activities/probe/probe.ts b/services/gateway/src/temporal/activities/probe/probe.ts index ebad00c1..e0134065 100644 --- a/services/gateway/src/temporal/activities/probe/probe.ts +++ b/services/gateway/src/temporal/activities/probe/probe.ts @@ -1,8 +1,8 @@ import { join } from 'node:path'; import invariant from 'tiny-invariant'; import { Context } from '@temporalio/activity'; -import mkdirp from 'mkdirp'; -import rimraf from 'rimraf'; +import { mkdirp } from 'mkdirp'; +import { rimraf } from 'rimraf'; import { headObject, retryablePutFile, @@ -31,7 +31,7 @@ export default async function probe( }, }); - const cancellationSignal = Context.current().cancellationSignal; + const cancelSignal = Context.current().cancellationSignal; const workingDir = join(WORK_DIR, uploadRecordId); @@ -54,7 +54,7 @@ export default async function probe( activityLogger.info(`Probing ${downloadPath}`); - const proc = runFfprobe(workingDir, downloadPath, cancellationSignal); + const proc = runFfprobe(workingDir, downloadPath, cancelSignal); proc.stdout?.on('data', (data) => { stdOutLines.push(String(data)); @@ -75,7 +75,7 @@ export default async function probe( key: `${uploadRecordId}/probe.json`, contentType: 'application/json', body: Buffer.from(probeJson), - signal: cancellationSignal, + cancelSignal, }); await updateUploadRecord(uploadRecordId, { diff --git a/services/gateway/src/temporal/activities/transcode/create-thumbnails.ts b/services/gateway/src/temporal/activities/transcode/create-thumbnails.ts index 351d60f0..547eb432 100644 --- a/services/gateway/src/temporal/activities/transcode/create-thumbnails.ts +++ b/services/gateway/src/temporal/activities/transcode/create-thumbnails.ts @@ -1,12 +1,12 @@ import { basename, join } from 'node:path'; import { stat } from 'node:fs/promises'; -import mkdirp from 'mkdirp'; +import { mkdirp } from 'mkdirp'; import { Context } from '@temporalio/activity'; import pMap from 'p-map'; import fastGlob from 'fast-glob'; import { chunk, compact, maxBy } from 'lodash-es'; import pRetry from 'p-retry'; -import rimraf from 'rimraf'; +import { rimraf } from 'rimraf'; import { retryablePutFile, streamObjectToFile } from '../../../util/s3'; import { runFfmpegThumbnails } from '../../../util/ffmpeg'; import { concatThumbs, imageToBlurhash } from '../../../util/images'; @@ -80,7 +80,7 @@ export default async function createThumbnails( contentType: 'image/jpeg', path: largestThumbnail, contentLength: (await stat(largestThumbnail)).size, - signal: Context.current().cancellationSignal, + cancelSignal: Context.current().cancellationSignal, }); await pRetry( async (attempt) => { @@ -121,7 +121,7 @@ export default async function createThumbnails( contentType: 'image/jpeg', path, contentLength: (await stat(path)).size, - signal: Context.current().cancellationSignal, + cancelSignal: Context.current().cancellationSignal, }); Context.current().heartbeat(); activityLogger.info(`Done uploading thumbnail: ${path}`); @@ -140,7 +140,7 @@ export default async function createThumbnails( key: `${uploadRecordId}/hovernail.jpg`, contentType: 'image/jpeg', path: join(workingDir, 'hovernail.jpg'), - signal: Context.current().cancellationSignal, + cancelSignal: Context.current().cancellationSignal, }); Context.current().heartbeat(); activityLogger.info('Done uploading hovernail'); diff --git a/services/gateway/src/temporal/activities/transcode/generate-peaks.ts b/services/gateway/src/temporal/activities/transcode/generate-peaks.ts index c7bb4544..3e995aad 100644 --- a/services/gateway/src/temporal/activities/transcode/generate-peaks.ts +++ b/services/gateway/src/temporal/activities/transcode/generate-peaks.ts @@ -1,8 +1,8 @@ import { join } from 'node:path'; import { stat } from 'node:fs/promises'; import { Context } from '@temporalio/activity'; -import mkdirp from 'mkdirp'; -import rimraf from 'rimraf'; +import { mkdirp } from 'mkdirp'; +import { rimraf } from 'rimraf'; import { runAudiowaveform } from '../../../util/audiowaveform'; import { retryablePutFile, streamObjectToFile } from '../../../util/s3'; import logger from '../../../util/logger'; @@ -26,7 +26,7 @@ export default async function generatePeaks( }); Context.current().heartbeat('job start'); - const cancellationSignal = Context.current().cancellationSignal; + const cancelSignal = Context.current().cancellationSignal; const workingDir = join(WORK_DIR, uploadRecordId); try { @@ -44,7 +44,7 @@ export default async function generatePeaks( const peakFiles = await runAudiowaveform( workingDir, downloadPath, - cancellationSignal, + cancelSignal, () => Context.current().heartbeat('audiowaveform'), ); @@ -57,7 +57,7 @@ export default async function generatePeaks( contentType: 'application/json', path: peakFiles.json, contentLength: (await stat(peakFiles.json)).size, - signal: cancellationSignal, + cancelSignal, }); Context.current().heartbeat('Uploaded peak json'); activityLogger.info('Uploaded peak json'); @@ -69,7 +69,7 @@ export default async function generatePeaks( contentType: 'application/octet-stream', path: peakFiles.dat, contentLength: (await stat(peakFiles.dat)).size, - signal: cancellationSignal, + cancelSignal, }); Context.current().heartbeat('Uploaded peak dat'); activityLogger.info('Uploaded peak dat'); diff --git a/services/gateway/src/temporal/activities/transcode/transcode.ts b/services/gateway/src/temporal/activities/transcode/transcode.ts index 70097b43..174dfca4 100644 --- a/services/gateway/src/temporal/activities/transcode/transcode.ts +++ b/services/gateway/src/temporal/activities/transcode/transcode.ts @@ -2,10 +2,10 @@ import { basename, join } from 'node:path'; import { unlink, stat } from 'node:fs/promises'; import { setTimeout } from 'node:timers/promises'; import { Context } from '@temporalio/activity'; -import mkdirp from 'mkdirp'; +import { mkdirp } from 'mkdirp'; import fastGlob from 'fast-glob'; import { throttle } from 'lodash-es'; -import rimraf from 'rimraf'; +import { rimraf } from 'rimraf'; import mime from 'mime'; import invariant from 'tiny-invariant'; import type { UploadVariant } from '@prisma/client'; @@ -44,7 +44,7 @@ const formatter = new Intl.ListFormat('en', { async function uploadSegments(id: string, dir: string, log: typeof logger) { const segmentFiles = await fastGlob(join(dir, '*.ts')); - const signal = Context.current().cancellationSignal; + const cancelSignal = Context.current().cancellationSignal; for (const path of segmentFiles) { Context.current().heartbeat(`Starting upload: ${path}`); @@ -56,7 +56,7 @@ async function uploadSegments(id: string, dir: string, log: typeof logger) { contentType: 'video/mp2ts', contentLength: (await stat(path)).size, path, - signal, + cancelSignal, }); log.info(`Done uploading media segment: ${path}`); @@ -82,7 +82,7 @@ export default async function transcode( }); Context.current().heartbeat('job start'); - const cancellationSignal = Context.current().cancellationSignal; + const cancelSignal = Context.current().cancellationSignal; const workingDir = join(WORK_DIR, uploadRecordId); const throttledUpdateUploadRecord = throttle(updateUploadRecord, 2500); @@ -123,7 +123,7 @@ export default async function transcode( inputFilename: downloadPath, probe, variants, - signal: cancellationSignal, + cancelSignal, hwAccel: HW_ACCEL, }); @@ -201,7 +201,7 @@ export default async function transcode( Context.current().heartbeat( `upload ${Math.round(progress * 1000) / 10}%`, ), - signal: cancellationSignal, + cancelSignal, }); Context.current().heartbeat(`Uploaded downloadable file: ${filename}`); activityLogger.info(`Uploaded downloadable file: ${filename}`); @@ -231,7 +231,7 @@ export default async function transcode( contentType: 'application/x-mpegURL', path, contentLength: (await stat(path)).size, - signal: cancellationSignal, + cancelSignal, }); Context.current().heartbeat(`Uploaded playlist file: ${filename}`); activityLogger.info(`Uploaded playlist file: ${filename}`); @@ -254,7 +254,7 @@ export default async function transcode( key: `${uploadRecordId}/master.m3u8`, contentType: 'application/x-mpegURL', body: playlistBuffer, - signal: cancellationSignal, + cancelSignal, }); Context.current().heartbeat('Uploaded master playlist file'); activityLogger.info('Uploaded master playlist file'); @@ -271,7 +271,7 @@ export default async function transcode( const peakFiles = await runAudiowaveform( workingDir, downloadPath, - cancellationSignal, + cancelSignal, () => Context.current().heartbeat('audiowaveform'), ); @@ -284,7 +284,7 @@ export default async function transcode( contentType: 'application/json', path: peakFiles.json, contentLength: (await stat(peakFiles.json)).size, - signal: cancellationSignal, + cancelSignal, }); Context.current().heartbeat('Uploaded peak json'); activityLogger.info('Uploaded peak json'); @@ -296,7 +296,7 @@ export default async function transcode( contentType: 'application/octet-stream', path: peakFiles.dat, contentLength: (await stat(peakFiles.dat)).size, - signal: cancellationSignal, + cancelSignal, }); Context.current().heartbeat('Uploaded peak dat'); activityLogger.info('Uploaded peak dat'); @@ -310,7 +310,7 @@ export default async function transcode( key: `${uploadRecordId}/stdout.txt`, contentType: 'text/plain', body: Buffer.from(stdout.join('')), - signal: cancellationSignal, + cancelSignal, }); activityLogger.info('Done uploading stdout'); Context.current().heartbeat('queueing stderr upload'); @@ -320,7 +320,7 @@ export default async function transcode( key: `${uploadRecordId}/stderr.txt`, contentType: 'text/plain', body: Buffer.from(stderr.join('')), - signal: cancellationSignal, + cancelSignal, }); activityLogger.info('Done uploading stderr'); Context.current().heartbeat('Uploaded stderr'); diff --git a/services/gateway/src/temporal/activities/transcribe/transcribe.ts b/services/gateway/src/temporal/activities/transcribe/transcribe.ts index df8474b6..54d4b559 100644 --- a/services/gateway/src/temporal/activities/transcribe/transcribe.ts +++ b/services/gateway/src/temporal/activities/transcribe/transcribe.ts @@ -1,8 +1,8 @@ import { join, extname } from 'node:path'; import { stat } from 'node:fs/promises'; import { Context } from '@temporalio/activity'; -import mkdirp from 'mkdirp'; -import rimraf from 'rimraf'; +import { mkdirp } from 'mkdirp'; +import { rimraf } from 'rimraf'; import mime from 'mime'; import invariant from 'tiny-invariant'; import { updateUploadRecord } from '../..'; @@ -35,7 +35,7 @@ export default async function transcribe( }); Context.current().heartbeat('job start'); - const cancellationSignal = Context.current().cancellationSignal; + const cancelSignal = Context.current().cancellationSignal; const workingDir = join(WORK_DIR, uploadRecordId); await updateUploadRecord(uploadRecordId, { @@ -56,7 +56,7 @@ export default async function transcribe( const outputFiles = await runWhisper( workingDir, downloadPath, - cancellationSignal, + cancelSignal, () => Context.current().heartbeat('whisper'), ); @@ -75,7 +75,7 @@ export default async function transcribe( contentType: mime.getType(ext) ?? 'text/plain', path: file, contentLength: (await stat(file)).size, - signal: cancellationSignal, + cancelSignal, }); activityLogger.info(`done uploading ${file}`); @@ -105,7 +105,7 @@ export default async function transcribe( contentType: 'text/vtt', body: fixedVtt, contentLength: fixedVtt.length, - signal: cancellationSignal, + cancelSignal, }); activityLogger.info(`done uploading transcript.vtt`); diff --git a/services/gateway/src/util/audiowaveform.ts b/services/gateway/src/util/audiowaveform.ts index 2dcbf323..8b94309f 100644 --- a/services/gateway/src/util/audiowaveform.ts +++ b/services/gateway/src/util/audiowaveform.ts @@ -8,7 +8,7 @@ const moduleLogger = logger.child({ module: 'util/ffmpeg' }); export async function runAudiowaveform( cwd: string, inputFilename: string, - signal: AbortSignal, + cancelSignal: AbortSignal, heartbeat = noop, ) { const wavFile = join(cwd, 'download.wav'); @@ -28,7 +28,7 @@ export async function runAudiowaveform( '1', wavFile, ], - { cwd, signal }, + { cwd, cancelSignal }, ); moduleLogger.info(`runAudiowaveform: ${ffmpegProc.spawnargs.join(' ')}`); @@ -45,7 +45,7 @@ export async function runAudiowaveform( const proc1 = execa( 'audiowaveform', ['-i', wavFile, '-b', '8', '-o', `${wavFile}.json`], - { cwd, signal }, + { cwd, cancelSignal }, ); moduleLogger.info(`runAudiowaveform: ${proc1.spawnargs.join(' ')}`); @@ -62,7 +62,7 @@ export async function runAudiowaveform( const proc2 = execa( 'audiowaveform', ['-i', wavFile, '-b', '8', '-o', `${wavFile}.dat`], - { cwd, signal }, + { cwd, cancelSignal }, ); moduleLogger.info(`runAudiowaveform: ${proc2.spawnargs.join(' ')}`); diff --git a/services/gateway/src/util/env-check.ts b/services/gateway/src/util/env-check.ts index faf7a773..543491d3 100644 --- a/services/gateway/src/util/env-check.ts +++ b/services/gateway/src/util/env-check.ts @@ -1,11 +1,11 @@ -import { execa, type ExecaReturnValue } from 'execa'; +import { execa, type Result } from 'execa'; import invariant from 'tiny-invariant'; function getHelp(bin: string) { return execa(bin, ['--help']); } -function checkCode(res: ExecaReturnValue) { +function checkCode(res: Result) { invariant(res.exitCode === 0, () => JSON.stringify({ stdout: res.stdout, stderr: res.stderr }), ); diff --git a/services/gateway/src/util/ffmpeg.ts b/services/gateway/src/util/ffmpeg.ts index f6ce0435..86527ffc 100644 --- a/services/gateway/src/util/ffmpeg.ts +++ b/services/gateway/src/util/ffmpeg.ts @@ -399,14 +399,14 @@ export function runFfmpegEncode({ probe, variants, hwAccel = 'none', - signal, + cancelSignal, }: { cwd: string; inputFilename: string; probe: Probe; variants: Array; hwAccel?: HwAccel; - signal: AbortSignal; + cancelSignal: AbortSignal; }) { const proc = execa( 'ffmpeg', @@ -423,7 +423,7 @@ export function runFfmpegEncode({ // Outputs ...ffmpegEncodingArgs(variants, probe, hwAccel), ], - { cwd, signal }, + { cwd, cancelSignal }, ); moduleLogger.info(`runFfmpegEncode: ${proc.spawnargs.join(' ')}`); @@ -435,7 +435,7 @@ export function runFfmpegThumbnails( cwd: string, inputFilename: string, probe: Probe, - signal: AbortSignal, + cancelSignal: AbortSignal, ) { const count = 100; const rate = 1 / (parseFloat(probe.format.duration) / count); @@ -456,7 +456,7 @@ export function runFfmpegThumbnails( `${rate}`, 'screenshot_v1_%03d.jpg', ], - { cwd, signal }, + { cwd, cancelSignal }, ); moduleLogger.info(`runFfmpegThumbnails: ${proc.spawnargs.join(' ')}`); @@ -468,7 +468,7 @@ export function runFfmpegThumbnails( export function runFfprobe( cwd: string, inputFilename: string, - signal: AbortSignal, + cancelSignal: AbortSignal, ) { const proc = execa( 'ffprobe', @@ -482,7 +482,7 @@ export function runFfprobe( /* '-count_frames', */ inputFilename, ], - { cwd, signal }, + { cwd, cancelSignal }, ); moduleLogger.info(`runFfmpegProbe: ${proc.spawnargs.join(' ')}`); diff --git a/services/gateway/src/util/s3.ts b/services/gateway/src/util/s3.ts index 672d6235..ff7aa046 100644 --- a/services/gateway/src/util/s3.ts +++ b/services/gateway/src/util/s3.ts @@ -350,14 +350,14 @@ export async function putFileMultipart({ contentType, path, onProgress, - signal, + cancelSignal, }: { to?: Client; key: string; contentType: string; path: string; onProgress?: (progress: number) => unknown; - signal?: AbortSignal; + cancelSignal?: AbortSignal; }) { const { bucket, client } = getClientAndBucket(to); @@ -378,7 +378,7 @@ export async function putFileMultipart({ const completedParts = []; for (let i = 0; i < numParts; i++) { - signal?.throwIfAborted(); + cancelSignal?.throwIfAborted(); const start = i * partSize; const end = Math.min(start + partSize, fileSize) - 1; @@ -421,7 +421,7 @@ export async function putFileMultipart({ export async function retryablePutFile({ maxAttempts = 5, - signal, + cancelSignal, ...otherOps }: { to?: Client; @@ -429,10 +429,10 @@ export async function retryablePutFile({ contentType: string; contentLength?: number; maxAttempts?: number; - signal: AbortSignal; + cancelSignal: AbortSignal; } & MergeExclusive<{ body: Buffer }, { path: string }>) { return pRetry(() => putFile(otherOps), { - signal, + signal: cancelSignal, retries: maxAttempts, onFailedAttempt: (error) => { moduleLogger.warn(`Error uploading ${otherOps.key}`); diff --git a/services/gateway/src/util/whisper.ts b/services/gateway/src/util/whisper.ts index 3807c8a0..f18b9b9c 100644 --- a/services/gateway/src/util/whisper.ts +++ b/services/gateway/src/util/whisper.ts @@ -15,7 +15,7 @@ const extraArgs = process.env['WHISPER_EXTRA_ARGS']?.split(' ') ?? []; export async function runWhisper( cwd: string, inputFilename: string, - signal: AbortSignal, + cancelSignal: AbortSignal, heartbeat = noop, ) { moduleLogger.info('Running whisper'); @@ -34,7 +34,7 @@ export async function runWhisper( 'True', ...extraArgs, ], - { cwd, signal }, + { cwd, cancelSignal }, ); moduleLogger.info(`runWhisper: ${proc.spawnargs.join(' ')}`);