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 () {
|
||||
if (!api.connection.connected()) {
|
||||
if (!api.connection.connected() || _converse.isTestEnv()) {
|
||||
return;
|
||||
}
|
||||
if (api.settings.get('ping_interval') > 0) {
|
||||
const ping_interval = api.settings.get('ping_interval');
|
||||
if (ping_interval > 0) {
|
||||
const now = new Date();
|
||||
if (!lastStanzaDate) {
|
||||
lastStanzaDate = now;
|
||||
}
|
||||
if ((now - lastStanzaDate)/1000 > api.settings.get('ping_interval')) {
|
||||
if ((now - lastStanzaDate)/1000 > ping_interval) {
|
||||
api.ping();
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user