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
commit e610b77f8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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