mirror of
https://github.com/plantroon/mx-puppet-xmpp.git
synced 2024-12-27 17:11:40 +00:00
hopefully fix reconnect on polling error
This commit is contained in:
parent
4cdddc4996
commit
bce6e78245
@ -126,7 +126,8 @@ async function run() {
|
||||
data.state = client.getState;
|
||||
await client.disconnect();
|
||||
} catch (err) {
|
||||
log.verbose("Failed to log in as new user, perhaps the password is worng?", err);
|
||||
log.verbose("Failed to log in as new user, perhaps the password is worng?");
|
||||
log.silly(err);
|
||||
retData.error = "Username or password wrong";
|
||||
return retData;
|
||||
}
|
||||
|
15
src/skype.ts
15
src/skype.ts
@ -19,6 +19,7 @@ import { Client } from "./client";
|
||||
import * as skypeHttp from "skype-http";
|
||||
import { Contact as SkypeContact } from "skype-http/dist/lib/types/contact";
|
||||
import { NewMediaMessage as SkypeNewMediaMessage } from "skype-http/dist/lib/interfaces/api/api";
|
||||
import { UnexpectedHttpStatusError } from "skype-http/dist/lib/errors";
|
||||
import * as decodeHtml from "decode-html";
|
||||
import * as escapeHtml from "escape-html";
|
||||
import { MatrixMessageParser } from "./matrixmessageparser";
|
||||
@ -183,12 +184,16 @@ export class Skype {
|
||||
});
|
||||
const MINUTE = 60000;
|
||||
client.on("error", async (err: Error) => {
|
||||
await this.puppet.sendStatusMessage(puppetId, "Error: " + err);
|
||||
await this.puppet.sendStatusMessage(puppetId, "Reconnecting in a minute... ");
|
||||
setTimeout(async () => {
|
||||
log.error("Error when polling");
|
||||
log.error(err);
|
||||
if (err.name === "UnexpectedHttpStatus") {
|
||||
await this.puppet.sendStatusMessage(puppetId, "Error: " + err);
|
||||
await this.puppet.sendStatusMessage(puppetId, "Reconnecting in a minute... ");
|
||||
await this.stopClient(puppetId);
|
||||
await this.startClient(puppetId);
|
||||
}, MINUTE);
|
||||
setTimeout(async () => {
|
||||
await this.startClient(puppetId);
|
||||
}, MINUTE);
|
||||
}
|
||||
});
|
||||
try {
|
||||
await client.connect();
|
||||
|
Loading…
Reference in New Issue
Block a user