Skip to content

Commit

Permalink
Merge pull request #168 from geraldoantonio/chore/optional-set-params
Browse files Browse the repository at this point in the history
chore: skip error on set parameter
  • Loading branch information
andrewmolyuk authored Aug 17, 2024
2 parents 2a4fde0 + 8140089 commit ff4cfdc
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,11 @@ class Leader extends EventEmitter {

async initDatabase() {
await this.db.command({ ping: 1 })
await this.db.admin().command({ setParameter: 1, ttlMonitorSleepSecs: 1 })
try {
await this.db.admin().command({ setParameter: 1, ttlMonitorSleepSecs: 1 })
} catch (_err) {

Check failure on line 28 in index.js

View workflow job for this annotation

GitHub Actions / lint

'_err' is defined but never used
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.')
}
const cursor = await this.db.listCollections({ name: this.key })
const exists = await cursor.hasNext()
const collection = exists
Expand Down

0 comments on commit ff4cfdc

Please sign in to comment.