Skip to content

Commit 6d3be20

Browse files
committed
refactor: make locations optional in QueueManagerConfig
1 parent 379dc03 commit 6d3be20

3 files changed

Lines changed: 4 additions & 21 deletions

File tree

src/queue_manager.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ class QueueManagerSingleton {
2828
}
2929
}
3030

31-
await Locator.registerFromGlob(config.locations)
31+
if (config.locations && config.locations.length > 0) {
32+
await Locator.registerFromGlob(config.locations)
33+
}
3234

3335
return this
3436
}
@@ -91,10 +93,6 @@ class QueueManagerSingleton {
9193
throw new errors.E_CONFIGURATION_ERROR(['Default adapter must be specified'])
9294
}
9395

94-
if (!config.locations || config.locations.length === 0) {
95-
throw new errors.E_CONFIGURATION_ERROR(['Job locations must be specified'])
96-
}
97-
9896
if (!config.adapters[config.default]) {
9997
throw new errors.E_CONFIGURATION_ERROR([
10098
`Default adapter "${config.default}" not found in adapters configuration`,

src/types/main.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,5 +102,5 @@ export interface QueueManagerConfig {
102102
retry?: RetryConfig
103103
queues?: Record<string, QueueConfig>
104104
worker?: WorkerConfig
105-
locations: string[]
105+
locations?: string[]
106106
}

tests/queue_manager.spec.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,6 @@ test.group('QueueManager', () => {
3838
}
3939
})
4040

41-
test('should validate locations presence', async ({ assert }) => {
42-
assert.plan(2)
43-
44-
try {
45-
await QueueManager.init({
46-
default: 'sync',
47-
adapters: { sync: sync() },
48-
locations: [],
49-
})
50-
} catch (error) {
51-
assert.instanceOf(error, errors.E_CONFIGURATION_ERROR)
52-
assert.equal(error.message, 'Configuration error. Reason: Job locations must be specified')
53-
}
54-
})
55-
5641
test('should validate that adapter is a function', async ({ assert }) => {
5742
assert.plan(2)
5843

0 commit comments

Comments
 (0)