Skip to content

Commit ff4cfdc

Browse files
authored
Merge pull request #168 from geraldoantonio/chore/optional-set-params
chore: skip error on set parameter
2 parents 2a4fde0 + 8140089 commit ff4cfdc

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

index.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,11 @@ class Leader extends EventEmitter {
2323

2424
async initDatabase() {
2525
await this.db.command({ ping: 1 })
26-
await this.db.admin().command({ setParameter: 1, ttlMonitorSleepSecs: 1 })
26+
try {
27+
await this.db.admin().command({ setParameter: 1, ttlMonitorSleepSecs: 1 })
28+
} catch (_err) {
29+
console.error('Error on running setParameter command on MongoDB server to enable TTL monitor sleep time to 1 second. This is not a critical error, but it may cause some performance issues.')
30+
}
2731
const cursor = await this.db.listCollections({ name: this.key })
2832
const exists = await cursor.hasNext()
2933
const collection = exists

0 commit comments

Comments
 (0)