Skip to content

Commit

Permalink
fix(sandbox): extend SandboxedJob from JobJsonSandbox (#2446) fixes #…
Browse files Browse the repository at this point in the history
  • Loading branch information
roggervalf authored Feb 24, 2024
1 parent 8f8cb88 commit 7606e36
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
7 changes: 4 additions & 3 deletions src/classes/child-processor.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { ParentCommand } from '../enums';
import { JobJson, SandboxedJob } from '../interfaces';
import { SandboxedJob } from '../interfaces';
import { JobJsonSandbox } from '../types';
import { errorToJSON } from '../utils';

enum ChildStatus {
Expand Down Expand Up @@ -61,7 +62,7 @@ export class ChildProcessor {
});
}

public async start(jobJson: JobJson, token?: string): Promise<void> {
public async start(jobJson: JobJsonSandbox, token?: string): Promise<void> {
if (this.status !== ChildStatus.Idle) {
return this.send({
cmd: ParentCommand.Error,
Expand Down Expand Up @@ -110,7 +111,7 @@ export class ChildProcessor {
* The wrapped job adds back some of those original functions.
*/
protected wrapJob(
job: JobJson,
job: JobJsonSandbox,
send: (msg: any) => Promise<void>,
): SandboxedJob {
return {
Expand Down
1 change: 0 additions & 1 deletion src/classes/job.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
JobJson,
JobJsonRaw,
MinimalJob,
MoveToDelayedOpts,
MoveToWaitingChildrenOpts,
ParentKeys,
ParentOpts,
Expand Down
5 changes: 2 additions & 3 deletions src/interfaces/sandboxed-job.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
import { JobsOptions } from '../types';
import { JobJson } from './job-json';
import { JobJsonSandbox, JobsOptions } from '../types';

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

0 comments on commit 7606e36

Please sign in to comment.