Skip to content

Commit 21d6b24

Browse files
committed
fix: mongo adapter warnings
1 parent 4f4a32e commit 21d6b24

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/adapters/mongodb.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,9 +184,11 @@ export class MongoDatabaseAdapter implements DatabaseAdapter {
184184

185185
// Main export - constructor pattern
186186
export class MongoQueue<T = Record<string, any>> extends DbQueue<T> {
187+
mongoAdapter: MongoDatabaseAdapter;
187188
constructor(config: { collection: MongoCollection }) {
188189
const adapter = new MongoDatabaseAdapter(config.collection);
189190
super(adapter);
191+
this.mongoAdapter = adapter;
190192
}
191193
}
192194

tests/integration/mongodb.test.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ describe('MongoDB Integration Tests (with TestContainers)', () => {
9090
const factoryQueue = await createMongoQueueFromUrl<TestJobs>(mongoUrl, testDatabase, 'url_test');
9191
expect(factoryQueue).toBeInstanceOf(MongoQueue);
9292

93+
// Wait for indexes to be created before closing the client
94+
await factoryQueue.mongoAdapter.ensureIndexes();
95+
9396
// Clean up the client created by the factory
9497
const factoryClient = (factoryQueue as any).db.col.client;
9598
if (factoryClient && factoryClient.close) {

0 commit comments

Comments
 (0)