Closed marlub closed 4 years ago
I second this, this also affects everything that is done with a command and it's quite frustrating. Using this library https://github.com/nrempel/adonis-scheduler/ is difficult because of this.
Yes, the provider will subscribe to events even on migrations and other commands. That will cause redis connection to open and will prevent the app from closing.
To prevent this, I built closeAll method that will close all connections this provider opened. In my projects, I registered hook before ace commands, and in that hook I closed all connections.
That was enaugh for me, so I never built anything more, however I am now considering to have option in configuration weather or not to open connection on ace commands. Adonis provides Helper method isAceCommand which would do the trick.
@ijakab I think the option would be nice. Please check out https://github.com/Rocketseat/adonis-bull . Especially this file: https://github.com/Rocketseat/adonis-bull/blob/master/src/Commands/Listen.js
It'll be nice for you to implement this so that running bull is optional and can be hooked to a command also.
@ijakab, please can you take a look at the other bull library?
I understant what you want, to have ability for main process not to subscribe to queues, and have ace command that subscribes to those (and optionally, other way around). I just cannot justify working on the feature my comapany does not need right now. Why not use this other library? Or, if you like, fork and make a merge request, I could also add you as a contributor?
@ijakab that'll be great! I'd find time to work on this. When I'm done, I'll raise a PR.
If there are unprocessed jobs and
adonis migration:run
is executing, these jobs get processed and the migrations begin to stuck. Jobs in general should not get executed on migrations, due to the possible schema changes, which also can affect the job.