Skip to content

Commit 7606e36

Browse files
authoredFeb 24, 2024··
fix(sandbox): extend SandboxedJob from JobJsonSandbox (#2446) fixes #2439
1 parent 8f8cb88 commit 7606e36

File tree

3 files changed

+6
-7
lines changed

3 files changed

+6
-7
lines changed
 

‎src/classes/child-processor.ts

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { ParentCommand } from '../enums';
2-
import { JobJson, SandboxedJob } from '../interfaces';
2+
import { SandboxedJob } from '../interfaces';
3+
import { JobJsonSandbox } from '../types';
34
import { errorToJSON } from '../utils';
45

56
enum ChildStatus {
@@ -61,7 +62,7 @@ export class ChildProcessor {
6162
});
6263
}
6364

64-
public async start(jobJson: JobJson, token?: string): Promise<void> {
65+
public async start(jobJson: JobJsonSandbox, token?: string): Promise<void> {
6566
if (this.status !== ChildStatus.Idle) {
6667
return this.send({
6768
cmd: ParentCommand.Error,
@@ -110,7 +111,7 @@ export class ChildProcessor {
110111
* The wrapped job adds back some of those original functions.
111112
*/
112113
protected wrapJob(
113-
job: JobJson,
114+
job: JobJsonSandbox,
114115
send: (msg: any) => Promise<void>,
115116
): SandboxedJob {
116117
return {

‎src/classes/job.ts

-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
JobJson,
99
JobJsonRaw,
1010
MinimalJob,
11-
MoveToDelayedOpts,
1211
MoveToWaitingChildrenOpts,
1312
ParentKeys,
1413
ParentOpts,

‎src/interfaces/sandboxed-job.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
import { JobsOptions } from '../types';
2-
import { JobJson } from './job-json';
1+
import { JobJsonSandbox, JobsOptions } from '../types';
32

43
/**
54
* @see {@link https://docs.bullmq.io/guide/workers/sandboxed-processors}
65
*/
76
export interface SandboxedJob<T = any, R = any>
8-
extends Omit<JobJson, 'data' | 'opts' | 'returnValue'> {
7+
extends Omit<JobJsonSandbox, 'data' | 'opts' | 'returnValue'> {
98
data: T;
109
opts: JobsOptions;
1110
moveToDelayed: (timestamp: number, token?: string) => Promise<void>;

0 commit comments

Comments
 (0)
Please sign in to comment.