disconnect even if it's been stopped before, logging improvements

pull/988/head
Ryan Tharp 5 years ago
parent 9a01317e96
commit a00aa73715

@ -84,6 +84,8 @@
}; };
this.pollServer = async () => { this.pollServer = async () => {
// bg.connect calls mr connect after storage system is ready
window.log.info('http-resource pollServer start');
// This blocking call will return only when all attempts // This blocking call will return only when all attempts
// at reaching snodes are exhausted or a DNS error occured // at reaching snodes are exhausted or a DNS error occured
try { try {
@ -93,25 +95,30 @@
messages => { messages => {
connected = true; connected = true;
messages.forEach(message => { messages.forEach(message => {
const { data } = message; this.handleMessage(message.data);
this.handleMessage(data);
}); });
} }
); );
} catch (e) { } catch (e) {
// we'll try again anyway // we'll try again anyway
window.log.error('http-resource pollServer error', e.code, e.message); window.log.error(
'http-resource pollServer error',
e.code,
e.message,
e.stack
);
} }
connected = false;
if (this.calledStop) { if (this.calledStop) {
// don't restart
return; return;
} }
connected = false;
// Exhausted all our snodes urls, trying again later from scratch // Exhausted all our snodes urls, trying again later from scratch
setTimeout(() => { setTimeout(() => {
window.log.info( window.log.info(
`Exhausted all our snodes urls, trying again in ${EXHAUSTED_SNODES_RETRY_DELAY / `http-resource: Exhausted all our snodes urls, trying again in ${EXHAUSTED_SNODES_RETRY_DELAY /
1000}s from scratch` 1000}s from scratch`
); );
this.pollServer(); this.pollServer();

Loading…
Cancel
Save