Disable interval handler when running tests
This commit is contained in:
parent
ff14a706cf
commit
4b737c1c93
@ -48,15 +48,16 @@ export function onConnected () {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function onEverySecond () {
|
export function onEverySecond () {
|
||||||
if (!api.connection.connected()) {
|
if (!api.connection.connected() || _converse.isTestEnv()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (api.settings.get('ping_interval') > 0) {
|
const ping_interval = api.settings.get('ping_interval');
|
||||||
|
if (ping_interval > 0) {
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
if (!lastStanzaDate) {
|
if (!lastStanzaDate) {
|
||||||
lastStanzaDate = now;
|
lastStanzaDate = now;
|
||||||
}
|
}
|
||||||
if ((now - lastStanzaDate)/1000 > api.settings.get('ping_interval')) {
|
if ((now - lastStanzaDate)/1000 > ping_interval) {
|
||||||
api.ping();
|
api.ping();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user