-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: allow bull manager to read other queues when user want to start…
… with app, without prior specification
- Loading branch information
Acidiney Dias
committed
Feb 15, 2024
1 parent
e79d3aa
commit de12c97
Showing
5 changed files
with
48 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,10 @@ | ||
/** | ||
* @acidiney/bull-queue | ||
* | ||
* @license MIT | ||
* @copyright Romain Lanz <[email protected]> | ||
*/ | ||
|
||
import { CommandOptions } from '@adonisjs/core/types/ace' | ||
import { stubsRoot } from '../stubs/main.js' | ||
import { BaseCommand, args } from '@adonisjs/core/ace' | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,10 @@ | ||
import { configProvider } from '@adonisjs/core' | ||
/** | ||
* @acidiney/bull-queue | ||
* | ||
* @license MIT | ||
* @copyright Romain Lanz <[email protected]> | ||
*/ | ||
|
||
import { BaseCommand, flags } from '@adonisjs/core/ace' | ||
import { CommandOptions } from '@adonisjs/core/types/ace' | ||
|
||
|
@@ -16,17 +22,7 @@ export default class QueueListener extends BaseCommand { | |
|
||
async run() { | ||
const Queue = await this.app.container.make('bull_queue') | ||
const queueConfigProvider = await this.app.config.get('queue') | ||
const config = await configProvider.resolve<any>(this.app, queueConfigProvider) | ||
|
||
if (!this.queue || this.queue.length === 0) this.queue = config.queueNames | ||
|
||
await Promise.all( | ||
this.queue.map(async (queue) => { | ||
await Queue.clear(queue) | ||
}) | ||
) | ||
|
||
return | ||
await Queue.clearBulk(this.queue) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
/** | ||
* @rlanz/bull-queue | ||
* @acidiney/bull-queue | ||
* | ||
* @license MIT | ||
* @copyright Romain Lanz <[email protected]> | ||
* @copyright Romain Lanz <[email protected]> | ||
*/ | ||
|
||
import { configProvider } from '@adonisjs/core' | ||
import { BaseCommand, flags } from '@adonisjs/core/ace' | ||
import { CommandOptions } from '@adonisjs/core/types/ace' | ||
|
||
|
@@ -23,18 +22,10 @@ export default class QueueListener extends BaseCommand { | |
|
||
async run() { | ||
const Queue = await this.app.container.make('bull_queue') | ||
const queueConfigProvider = await this.app.config.get('queue') | ||
const config = await configProvider.resolve<any>(this.app, queueConfigProvider) | ||
|
||
const router = await this.app.container.make('router') | ||
router.commit() | ||
|
||
if (!this.queue || this.queue.length === 0) this.queue = config.queueNames | ||
|
||
this.queue.map((q) => | ||
Queue.process({ | ||
queueName: q, | ||
}) | ||
) | ||
Queue.processBulk(this.queue) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,10 @@ | ||
/** | ||
* @rlanz/bull-queue | ||
* @acidiney/bull-queue | ||
* | ||
* @license MIT | ||
* @copyright Romain Lanz <[email protected]> | ||
* @copyright Romain Lanz <[email protected]> | ||
*/ | ||
|
||
import { configProvider } from '@adonisjs/core' | ||
import { BaseCommand, flags } from '@adonisjs/core/ace' | ||
import { CommandOptions } from '@adonisjs/core/types/ace' | ||
|
||
|
@@ -26,14 +25,10 @@ export default class QueueListener extends BaseCommand { | |
|
||
async run() { | ||
const Queue = await this.app.container.make('bull_queue') | ||
const queueConfigProvider = await this.app.config.get('queue') | ||
const config = await configProvider.resolve<any>(this.app, queueConfigProvider) | ||
|
||
const router = await this.app.container.make('router') | ||
router.commit() | ||
|
||
if (!this.queue || this.queue.length === 0) this.queue = config.queueNames | ||
|
||
await Queue.ui(this.port || 9999, this.queue) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters