Killing off zombie backgroundRB processes?


I have a mailer that mails out our mailing list emails. I run this by
passing control to send the emails out to a backgrounDRB task. this
works great.

But I can’t seem to kill them off! I end up with several BackgrounDRB
tasks running.

I looked at using the named type of BackgrounDRB task and only ever
using one, but there are times when two newsletters go out, and this
obviously won’t work.

Using the worker.delete command isn’t suitable as I don’t know how
long a mailout will take.

I thought about naming each worker, then putting this into an AR
model, then running another backgrounDRB task or cronjob that logs in,
checks the table to see which workers are complete and do a
worker.delete… but I can’t quite get that working.

What I am after (that I haven’t found) is something like a “self.kill”
that i could put at the end of the do_work method as once the do_work
method is complete, the backgrounDRB task should unload.

Any working ideas?