madeindjs / nestjs-graphile-worker

A Nest.js wrapper for Graphile Worker
https://www.npmjs.com/package/nestjs-graphile-worker
MIT License
34 stars 12 forks source link

Cancelling scheduled jobs #18

Open NickTsitlakidis opened 4 months ago

NickTsitlakidis commented 4 months ago

Hello everyone.

First of all, thanks for the very nice abstraction you have implemented here. It makes using Graphile with nest very easy and clean.

I'm mostly using the queues with scheduled jobs and I have cases where a scheduled job might need to be cancelled.

Based on my understanding this is supported by Graphile : https://worker.graphile.org/docs/admin-functions#complete-jobs

So I'm wondering if this could be added as a method to the WorkerService.

For example, if we have access to the job id when we do WorkerService.addJob(), then at some point in the future, this id could be used to mark the job as completed using a new method.

Let me know if this would be of interest to you and if you are interested I can make a PR for it.

madeindjs commented 4 months ago

Hello @NickTsitlakidis ,

Good idea. Did you try to use the runner from this commit https://github.com/madeindjs/nestjs-graphile-worker/commit/837d2d68a5acc493a32469f11be8aaf8d95c07db . if it doesn't suit you , you can try to implement what you need and I'll preview it and publish it 😄