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

'removed' event inconsistent parameter #2115

Open
aste-mikkok opened this issue Jul 23, 2021 · 2 comments
Open

'removed' event inconsistent parameter #2115

aste-mikkok opened this issue Jul 23, 2021 · 2 comments
Labels

Comments

@aste-mikkok
Copy link

aste-mikkok commented Jul 23, 2021

According to REFERENCE.md:

.on('removed', function (job) {
  // A job successfully removed.
});

In job.js this event is emited with job id here:

Job.remove = async function(queue, pattern) {
  await queue.isReady();
  const removed = await scripts.removeWithPattern(queue, pattern);
  removed.forEach(jobId => queue.emit('removed', jobId));
};

And with the full Job object here:

Job.prototype.remove = function() {
  const queue = this.queue;
  const job = this;

  return queue.isReady().then(() => {
    return scripts.remove(queue, job.id).then(removed => {
      if (removed) {
        queue.emit('removed', job);
      } else {
        throw new Error('Could not remove job ' + job.id);
      }
    });
  });
};

@aste-mikkok aste-mikkok reopened this Jul 23, 2021
@aste-mikkok aste-mikkok changed the title Documentation for 'removed 'removed' event inconsistent parameter Jul 23, 2021
@stale
Copy link

stale bot commented Sep 21, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the wontfix label Sep 21, 2021
@stale stale bot closed this as completed Sep 28, 2021
@manast manast reopened this Sep 29, 2021
@stale stale bot removed the wontfix label Sep 29, 2021
@manast manast added the bug label Sep 29, 2021
@manast
Copy link
Member

manast commented Sep 29, 2021

There are two alternatives here, either create a new event type for removing from pattern, or to change the event signature to be string OR Job, and the code in the event listener can then decide what to do.

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

No branches or pull requests

2 participants