vapor/queues

Allow single process workers

jdmcd opened this issue · 4 comments

jdmcd commented

Users should be able to specify that the jobs worker should be run in the same process as the web application instead of running via a separate CLI command

I think this would be easier said than done since it would require inventing some way for two commands to run at once. Or we'd need to make a separate command that serves + runs jobs. Either way, composability of commands would be an issue I think.

jdmcd commented

That's what I thought at first too, but I think it would be pretty easy to just abstract the logic inside of the existing command into another class that could be called manually, right? So in jobs.swift you could run:

JobsCommand().run()

And since the existing method doesn't return a future already it should be setup to just run in the background.

Ah, yeah, that makes sense. That seems related to abstracting out Jobs into JobsKit, too. The command stuff should really just be calling into APIs that the user themselves can call if they want to build custom commands 👍

jdmcd commented

Yeah agreed, we should abstract some of this stuff out