fix: increase worker pool timeout as temp fix
This commit is contained in:
parent
13c94a81cc
commit
6e3a6249c7
1 changed files with 2 additions and 1 deletions
|
@ -1,6 +1,7 @@
|
||||||
import { spawn, Worker, Pool } from "threads";
|
import { spawn, Worker, Pool } from "threads";
|
||||||
import "../loadEnv";
|
import "../loadEnv";
|
||||||
import type { CryptFns } from "./cryptWorker";
|
import type { CryptFns } from "./cryptWorker";
|
||||||
|
import { MINUTES } from "../utils";
|
||||||
|
|
||||||
if (!process.env.KEY) {
|
if (!process.env.KEY) {
|
||||||
// tslint:disable-next-line:no-console
|
// tslint:disable-next-line:no-console
|
||||||
|
@ -9,7 +10,7 @@ if (!process.env.KEY) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const KEY = process.env.KEY;
|
const KEY = process.env.KEY;
|
||||||
const pool = Pool(() => spawn(new Worker("./cryptWorker")), 8);
|
const pool = Pool(() => spawn(new Worker("./cryptWorker"), { timeout: 10 * MINUTES }), 8);
|
||||||
|
|
||||||
export async function encrypt(data: string) {
|
export async function encrypt(data: string) {
|
||||||
return pool.queue((w) => w.encrypt(data, KEY));
|
return pool.queue((w) => w.encrypt(data, KEY));
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue