mirror of
https://github.com/openstf/stf
synced 2025-10-03 17:59:28 +02:00
Make ZMQ keepalive options optional, since they're breaking things on
some systems. You should now use the ZMQ_TCP_KEEPALIVE=1 and ZMQ_TCP_KEEPALIVE_IDLE=<value> environment variables to set them.
This commit is contained in:
parent
396cfbad7f
commit
8e8f2d17b7
1 changed files with 10 additions and 7 deletions
|
@ -11,13 +11,16 @@ var log = require('./logger').createLogger('util:zmqutil')
|
|||
module.exports.socket = function() {
|
||||
var sock = zmq.socket.apply(zmq, arguments)
|
||||
|
||||
try {
|
||||
sock.setsockopt(zmq.ZMQ_TCP_KEEPALIVE, 1)
|
||||
sock.setsockopt(zmq.ZMQ_TCP_KEEPALIVE_IDLE, 300000)
|
||||
}
|
||||
catch (err) {
|
||||
log.warn('ZeroMQ library too old, no support for TCP keepalive options')
|
||||
}
|
||||
;['ZMQ_TCP_KEEPALIVE', 'ZMQ_TCP_KEEPALIVE_IDLE'].forEach(function(opt) {
|
||||
if (process.env[opt]) {
|
||||
try {
|
||||
sock.setsockopt(zmq[opt], +process.env[opt])
|
||||
}
|
||||
catch (err) {
|
||||
log.warn('ZeroMQ library too old, no support for %s', opt)
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
return sock
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue