Skip to content

Commit ffb63e0

Browse files
committed
Better waiting
1 parent 65c4ef1 commit ffb63e0

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

server/src/services/EventManager.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
/* eslint-disable no-promise-executor-return */
12
/* eslint-disable no-await-in-loop */
23
/* eslint-disable no-console */
34
const { promises: fs } = require('fs')
@@ -26,7 +27,8 @@ module.exports = class EventManager {
2627
this.available.pokemon = await Db.getAvailable('Pokemon')
2728
this.available.pokestops = await Db.getAvailable('Pokestop')
2829
while (!this.available.pokestops.length && this.pokestopTry <= config.database.settings.availableRetryCount) {
29-
console.log(`[EVENT] No pokestops found, trying again in 10 seconds (attempt ${this.pokestopTry} / ${config.database.settings.availableRetryCount})`)
30+
console.log(`[EVENT] No pokestops found, trying again in 1 second (attempt ${this.pokestopTry} / ${config.database.settings.availableRetryCount})`)
31+
await new Promise(resolve => setTimeout(resolve, 1000))
3032
this.available.pokestops = await Db.getAvailable('Pokestop')
3133
this.pokestopTry += 1
3234
}

0 commit comments

Comments
 (0)