Skip to content

feat: add job retrying and failed:fatal events#227

Merged
compwright merged 1 commit intomasterfrom
improve-job-events
Nov 6, 2023
Merged

feat: add job retrying and failed:fatal events#227
compwright merged 1 commit intomasterfrom
improve-job-events

Conversation

@skeggse
Copy link
Member

@skeggse skeggse commented Apr 14, 2020

Adds the documented but missing retrying event, and adds a failed:fatal event that signals that
a job has failed permanently. The failed event remains as it was, signaling job execution
failures without signaling the outcome of the job.

Fixes #184; see #186 for more discussion and an alternate proposal.

@skeggse skeggse requested a review from hughsw April 14, 2020 21:22
@skeggse skeggse self-assigned this Apr 14, 2020
@@ -545,9 +544,8 @@ class Queue extends Emitter {
}

_finishJob(err, data, job) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactored this method and moved some code to Job#computeDelay so we can compute the final status early.

Comment on lines +686 to +723
// Workaround for #184: emit failed event for backwards
// compatibility while affording for a separate event that
// identifies the final failure.
const emitExtra =
status === 'retrying'
? 'failed'
: status === 'failed'
? 'failed:fatal'
: null;
if (emitExtra) this.emit(emitExtra, job, result);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the key change that addresses #184.

@coveralls
Copy link

coveralls commented Apr 14, 2020

Coverage Status

Coverage remained the same at 100.0% when pulling f78ad0f on improve-job-events into 9d59aac on master.

@compwright
Copy link
Collaborator

@skeggse this needs a rebase, are you able to take care of that?

@compwright compwright requested review from compwright and removed request for hughsw November 23, 2022 01:15
@skeggse
Copy link
Member Author

skeggse commented Nov 23, 2022

I could rebase, sure. That said, I would favor #186 over this pull request since you seem to be comfortable making breaking changes to bee-queue. Was the decision to close #186 in favor of #227 an explicit/intentional decision? What's the rationale, if I may ask?

@compwright
Copy link
Collaborator

@skeggse actually I'm trying to avoid breaking changes, perhaps I misunderstood the effect of this PR? #186 was closed because it was a) apparently abandoned and b) you appeared to have problems with it. If #227 isn't the way to go, then we we should close it.

@skeggse
Copy link
Member Author

skeggse commented Nov 23, 2022

Ah, fair enough then. I don't recall these discussions or this PR well enough to green-light anything, but I'll try and find some time to rebase over the next few days.

@skeggse skeggse force-pushed the improve-job-events branch 2 times, most recently from 7916cef to 9f4d4e2 Compare December 5, 2022 06:07
Adds the documented but missing `retrying` event, and adds a `failed:fatal` event that signals that
a job has failed permanently. The `failed` event remains as it was, signaling job execution
failures without signaling the outcome of the job.

Co-authored-by: Hugh Secker-Walker <hsw@hodain.net>
@skeggse skeggse force-pushed the improve-job-events branch from 9f4d4e2 to f78ad0f Compare December 5, 2022 06:09
@skeggse
Copy link
Member Author

skeggse commented Dec 5, 2022

Rebased, largely to reconcile against the changes in #134. Unfortunately, it seems the tests are flaky. I don't know if this is a new upstream regression, or something that changed in this branch, but I don't have the bandwidth to diagnose that. It's especially difficult to debug in this project because ava doesn't report which test(s) were responsible for the timeout (or at least, that used to be its behavior, and I don't see any obvious change in the output that would suggest otherwise).

@skeggse skeggse assigned compwright and unassigned skeggse Dec 5, 2022
@compwright
Copy link
Collaborator

compwright commented Dec 5, 2022

Unfortunately, it seems the tests are flaky.

Could you describe your setup? I'm getting intermittent and inconsistent test failures when I run the tests locally on my M1 MacBook Pro with Redis 6.2 and Node 16.17.1.

Strangely, they pass consistently when run in CI. Not sure what's up with that, more data may suggest a solution.

@compwright compwright changed the title feat: improve job failure events feat: add job retrying and failed:fatal events Dec 5, 2022
@compwright compwright requested a review from bradvogel December 5, 2022 17:54
@compwright
Copy link
Collaborator

@jorenvandeweyer please add your review! Thanks :)

@skeggse
Copy link
Member Author

skeggse commented Dec 5, 2022

Could you describe your setup? I'm getting intermittent and inconsistent test failures when I run the tests locally on my M1 MacBook Pro with Redis 6.2 and Node 16.17.1.

Strangely, they pass consistently when run in CI. Not sure what's up with that, more data may suggest a solution.

Ah, this is in CI. It (seemed to) pass consistently in my local setup. Just a redis-server on an intel mac running macOS 11.7.1.

@jorenvandeweyer
Copy link

Unfortunately, it seems the tests are flaky.

Could you describe your setup? I'm getting intermittent and inconsistent test failures when I run the tests locally on my M1 MacBook Pro with Redis 6.2 and Node 16.17.1.

Strangely, they pass consistently when run in CI. Not sure what's up with that, more data may suggest a solution.

@compwright I'm seeing the same inconsistent test failures on my M1 Pro (I'm using DBngin). I suggest you run the tests using Docker for now.

@compwright compwright merged commit 15d02c2 into master Nov 6, 2023
@compwright compwright deleted the improve-job-events branch November 6, 2023 15:58
beequeueci pushed a commit that referenced this pull request Nov 6, 2023
## [1.7.0](v1.6.0...v1.7.0) (2023-11-06)

### Features

* improve job failure events ([#227](#227)) ([15d02c2](15d02c2))
@beequeueci
Copy link
Collaborator

🎉 This PR is included in version 1.7.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Queue Local 'failed' called instead of 'retrying' event

5 participants

Comments