timgit / pg-boss

Queueing jobs in Node.js using PostgreSQL like a boss
MIT License
1.73k stars 144 forks source link

Document onComplete option #432

Closed unzico closed 7 months ago

unzico commented 7 months ago

Hi there,

thank your very much for developing this valuable project.

Unfortunately, I just spent a few hours trying to figure out why the onComplete feature (documented here) didn't work. Turns out, one has to enable it when instantiating pg-boss.

Example:

import PgBoss from "pg-boss";

const pgBoss = new PgBoss({
  // option must be enabled for pgBoss.onComplete to work
  onComplete: true,
});

// now I can use it like so
pgBoss.onComplete("*", (job) => { ... })

However, this requirement is neither documented in the 'instantiate pg-boss with options' section nor the 'onComplete method' section.

Note: I just noticed there's a small documentation about it in the section about the send method.

I wish it would be obvious that one has to enable this option globally to make use of this feature :).

timgit commented 7 months ago

I don't have a release date in mind yet, but v10 removes this option completely, so one way or another, the documentation issue will be resolved. :)