Log when there are errors polling

pull/473/head
Beaudan Brown 6 years ago
parent 0dd180d4f4
commit da97d15891

@ -365,6 +365,17 @@ class LokiPublicChannelAPI {
// get moderation actions
async pollForDeletions() {
try {
await this.pollOnceForDeletions();
} catch (e) {
log.warn(`Error while polling for public chat deletions: ${e}`);
}
setTimeout(() => {
this.pollForDeletions();
}, DELETION_POLL_EVERY);
}
async pollOnceForDeletions() {
// grab the last 200 deletions
const params = {
count: 200,
@ -402,22 +413,18 @@ class LokiPublicChannelAPI {
this.deleteLastId = res.response.meta.max_id;
({ more } = res.response);
}
// set up next poll
setTimeout(() => {
this.pollForDeletions();
}, DELETION_POLL_EVERY);
}
// get channel messages
async pollForMessages() {
try {
await this.pollOnceForMessages();
} finally {
setTimeout(() => {
this.pollForMessages();
}, GROUPCHAT_POLL_EVERY);
} catch (e) {
log.warn(`Error while polling for public chat messages: ${e}`);
}
setTimeout(() => {
this.pollForMessages();
}, GROUPCHAT_POLL_EVERY);
}
async pollOnceForMessages() {

Loading…
Cancel
Save