Merge pull request #10397 from mabashian/job-output-socket-reconnect

Don't reconnect job output socket if it closes cleanly

SUMMARY
See #9795 (comment)
ISSUE TYPE

Bugfix Pull Request

COMPONENT NAME

UI

Reviewed-by: Jake McDermott <yo@jakemcdermott.me>
Reviewed-by: Tiago Góes <tiago.goes2009@gmail.com>
This commit is contained in:
softwarefactory-project-zuul[bot]
2021-06-10 14:51:14 +00:00
committed by GitHub

View File

@@ -228,11 +228,13 @@ function connectJobSocket({ type, id }, onMessage) {
}; };
ws.onclose = e => { ws.onclose = e => {
// eslint-disable-next-line no-console if (e.code !== 1000) {
console.debug('Socket closed. Reconnecting...', e); // eslint-disable-next-line no-console
setTimeout(() => { console.debug('Socket closed. Reconnecting...', e);
connectJobSocket({ type, id }, onMessage); setTimeout(() => {
}, 1000); connectJobSocket({ type, id }, onMessage);
}, 1000);
}
}; };
ws.onerror = err => { ws.onerror = err => {