force reconnect if countdown is negative (computer woke up from sleep)
This commit is contained in:
@@ -622,7 +622,7 @@ class TinodeWeb extends React.Component {
|
|||||||
|
|
||||||
if (prom) {
|
if (prom) {
|
||||||
// Reconnecting now
|
// Reconnecting now
|
||||||
prom.then(() => {
|
prom.then(_ => {
|
||||||
// Reconnected: clear error
|
// Reconnected: clear error
|
||||||
this.handleError();
|
this.handleError();
|
||||||
}).catch((err) => {
|
}).catch((err) => {
|
||||||
@@ -634,10 +634,17 @@ class TinodeWeb extends React.Component {
|
|||||||
const {formatMessage} = this.props.intl;
|
const {formatMessage} = this.props.intl;
|
||||||
let count = sec / 1000;
|
let count = sec / 1000;
|
||||||
count = count | count;
|
count = count | count;
|
||||||
this.reconnectCountdown = setInterval(() => {
|
this.reconnectCountdown = setInterval(_ => {
|
||||||
const timeLeft = (count > 99) ? secondsToTime(count) : count;
|
if (count < -10) {
|
||||||
|
// Count could go to negative if computer woke up from sleep.
|
||||||
|
clearInterval(this.reconnectCountdown);
|
||||||
|
this.tinode.reconnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const fmtTime = (count > 99) ? secondsToTime(count) : count;
|
||||||
this.handleError(
|
this.handleError(
|
||||||
formatMessage(messages.reconnect_countdown, {seconds: timeLeft}),
|
formatMessage(messages.reconnect_countdown, {seconds: fmtTime}),
|
||||||
'warn',
|
'warn',
|
||||||
_ => {
|
_ => {
|
||||||
clearInterval(this.reconnectCountdown);
|
clearInterval(this.reconnectCountdown);
|
||||||
|
|||||||
+9
-4
@@ -8071,7 +8071,7 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (prom) {
|
if (prom) {
|
||||||
prom.then(() => {
|
prom.then(_ => {
|
||||||
this.handleError();
|
this.handleError();
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
this.handleError(err.message, 'err');
|
this.handleError(err.message, 'err');
|
||||||
@@ -8083,10 +8083,15 @@ class TinodeWeb extends (react__WEBPACK_IMPORTED_MODULE_0___default().Component)
|
|||||||
} = this.props.intl;
|
} = this.props.intl;
|
||||||
let count = sec / 1000;
|
let count = sec / 1000;
|
||||||
count = count | count;
|
count = count | count;
|
||||||
this.reconnectCountdown = setInterval(() => {
|
this.reconnectCountdown = setInterval(_ => {
|
||||||
const timeLeft = count > 99 ? (0,_lib_strformat_js__WEBPACK_IMPORTED_MODULE_19__.secondsToTime)(count) : count;
|
if (count < -10) {
|
||||||
|
clearInterval(this.reconnectCountdown);
|
||||||
|
this.tinode.reconnect();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const fmtTime = count > 99 ? (0,_lib_strformat_js__WEBPACK_IMPORTED_MODULE_19__.secondsToTime)(count) : count;
|
||||||
this.handleError(formatMessage(messages.reconnect_countdown, {
|
this.handleError(formatMessage(messages.reconnect_countdown, {
|
||||||
seconds: timeLeft
|
seconds: fmtTime
|
||||||
}), 'warn', _ => {
|
}), 'warn', _ => {
|
||||||
clearInterval(this.reconnectCountdown);
|
clearInterval(this.reconnectCountdown);
|
||||||
this.tinode.reconnect();
|
this.tinode.reconnect();
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user