mirror of
https://github.com/openstf/stf
synced 2025-10-05 02:29:26 +02:00
Unify socket closers. Don't put them all in one try-catch or some might remain.
This commit is contained in:
parent
f2bcacba00
commit
4ca5230402
5 changed files with 34 additions and 19 deletions
|
@ -72,6 +72,11 @@ module.exports = function(options) {
|
||||||
logger.LevelLabel[options.priority])
|
logger.LevelLabel[options.priority])
|
||||||
|
|
||||||
lifecycle.observe(function() {
|
lifecycle.observe(function() {
|
||||||
|
try {
|
||||||
sub.close()
|
sub.close()
|
||||||
|
}
|
||||||
|
catch (err) {
|
||||||
|
// No-op
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,10 +161,13 @@ module.exports = function(options) {
|
||||||
.handler())
|
.handler())
|
||||||
|
|
||||||
lifecycle.observe(function() {
|
lifecycle.observe(function() {
|
||||||
|
[appDealer, devDealer].forEach(function(sock) {
|
||||||
try {
|
try {
|
||||||
appDealer.close()
|
sock.close()
|
||||||
devDealer.close()
|
|
||||||
}
|
}
|
||||||
catch (err) {}
|
catch (err) {
|
||||||
|
// No-op
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -394,13 +394,16 @@ module.exports = function(options) {
|
||||||
})()
|
})()
|
||||||
|
|
||||||
lifecycle.observe(function() {
|
lifecycle.observe(function() {
|
||||||
clearTimeout(totalsTimer)
|
[push, sub].forEach(function(sock) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
push.close()
|
sock.close()
|
||||||
sub.close()
|
|
||||||
}
|
}
|
||||||
catch (err) {}
|
catch (err) {
|
||||||
|
// No-op
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
clearTimeout(totalsTimer)
|
||||||
|
|
||||||
return Promise.all(Object.keys(workers).map(function(serial) {
|
return Promise.all(Object.keys(workers).map(function(serial) {
|
||||||
return workers[serial].cancel()
|
return workers[serial].cancel()
|
||||||
|
|
|
@ -53,6 +53,8 @@ module.exports = function(options) {
|
||||||
try {
|
try {
|
||||||
push.close()
|
push.close()
|
||||||
}
|
}
|
||||||
catch (err) {}
|
catch (err) {
|
||||||
|
// No-op
|
||||||
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,11 +34,13 @@ module.exports = function(options) {
|
||||||
log.info('PULL socket bound on', options.endpoints.pull)
|
log.info('PULL socket bound on', options.endpoints.pull)
|
||||||
|
|
||||||
lifecycle.observe(function() {
|
lifecycle.observe(function() {
|
||||||
|
[pub, dealer, pull].forEach(function(sock) {
|
||||||
try {
|
try {
|
||||||
pub.close()
|
sock.close()
|
||||||
dealer.close()
|
|
||||||
pull.close()
|
|
||||||
}
|
}
|
||||||
catch (err) {}
|
catch (err) {
|
||||||
|
// No-op
|
||||||
|
}
|
||||||
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue