Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

performInline: afterPerform does not get called on perform error #772

Closed
stellarhoof opened this issue Mar 18, 2022 · 3 comments · Fixed by #773
Closed

performInline: afterPerform does not get called on perform error #772

stellarhoof opened this issue Mar 18, 2022 · 3 comments · Fixed by #773
Labels

Comments

@stellarhoof
Copy link
Contributor

What the title says. Here's a test case:

  it('should call afterPerform given perform throws error', async () => {
    let callback = jest.fn()

    class MyPlugin extends Plugin {
      afterPerform() {
        callback(this.worker.error)
      }
    }

    let job = {
      plugins: [MyPlugin],
      perform(x) {
        throw new TypeError(x)
      },
    }

    let worker = new Worker({}, { job })

    await worker.performInline('job', ['John'])

    expect(callback).toHaveBeenCalledWith(new TypeError('John'))
  })
@stellarhoof stellarhoof changed the title afterPerform does not get called on perform error when using worker.performInline performInline: afterPerform does not get called on perform error Mar 18, 2022
@evantahler
Copy link
Member

Thanks @stellarhoof! Do you want to submit a PR to fix this? Let me know how I can help!

@evantahler evantahler added the bug label Mar 18, 2022
@evantahler
Copy link
Member

The relevant area of the code is probably here - https://github.com/actionhero/node-resque/blob/main/src/core/worker.ts#L353-L365.

@stellarhoof
Copy link
Contributor Author

@evantahler Will do

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants