@cavai/adonis-queue
Version:
> Basic AdonisJS queue provider
45 lines (44 loc) • 2.06 kB
JavaScript
;
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
Object.defineProperty(exports, "__esModule", { value: true });
const ace_1 = require("@adonisjs/ace");
class StartQueue extends ace_1.BaseCommand {
async run() {
const QueueManager = this.application.container.use('Cavai/Adonis-Queue');
const Config = this.application.container.use('Adonis/Core/Config');
/**
* We need to commit routes, otherwise might get issues,
* since @adonisjs/drive tries to register it's routes at startup
* without commiting routes trying to use Drive inside job will might errors
* Especially when also using @adonisjs/attachment-lite
*/
const router = this.application.container.resolveBinding('Adonis/Core/Route');
router.commit();
await QueueManager.start(this.name || Config.get('queue.default'));
}
}
StartQueue.settings = {
stayAlive: true,
loadApp: true,
};
/**
* Command Name is used to run the command
*/
StartQueue.commandName = 'queue:start';
/**
* Command Name is displayed in the "help" output
*/
StartQueue.description = 'Run the queue';
__decorate([
ace_1.args.string({ description: 'Queue name to run', required: false }),
__metadata("design:type", String)
], StartQueue.prototype, "name", void 0);
exports.default = StartQueue;