mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-04-24 19:59:12 +00:00
fix(DiscordService): only delay on failure not first time
This commit is contained in:
parent
fb122015cb
commit
665caea4c5
1 changed files with 13 additions and 15 deletions
|
@ -41,22 +41,20 @@ class DiscordService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
async bootstrap() {
|
async bootstrap() {
|
||||||
setTimeout(() => {
|
try {
|
||||||
try {
|
const ownUser = await this.rpc.ownUser(new Empty(), this.sharedHeaders)
|
||||||
const ownUser = await this.rpc.ownUser(new Empty(), this.sharedHeaders)
|
this.ownUser = ownUser.toObject()
|
||||||
this.ownUser = ownUser.toObject()
|
|
||||||
|
const listGuilds = await this.rpc.listGuilds(new Empty(), this.sharedHeaders)
|
||||||
const listGuilds = await this.rpc.listGuilds(new Empty(), this.sharedHeaders)
|
this.syncGuilds(listGuilds.toObject().guildsList)
|
||||||
this.syncGuilds(listGuilds.toObject().guildsList)
|
} catch (e) {
|
||||||
} catch (e) {
|
this.bootstrapRetries++
|
||||||
this.bootstrapRetries++
|
if (this.bootstrapRetries < this.bootstrapRetriesMax) {
|
||||||
if (this.bootstrapRetries < this.bootstrapRetriesMax) {
|
return setTimeout(() => this.bootstrap(), 1000)
|
||||||
return this.bootstrap()
|
} else {
|
||||||
} else {
|
throw e
|
||||||
throw e
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}, 1000)
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ownGm(server) {
|
ownGm(server) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue