mirror of
https://github.com/openstf/stf
synced 2025-10-04 02:09:32 +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() {
|
module.exports.socket = function() {
|
||||||
var sock = zmq.socket.apply(zmq, arguments)
|
var sock = zmq.socket.apply(zmq, arguments)
|
||||||
|
|
||||||
try {
|
;['ZMQ_TCP_KEEPALIVE', 'ZMQ_TCP_KEEPALIVE_IDLE'].forEach(function(opt) {
|
||||||
sock.setsockopt(zmq.ZMQ_TCP_KEEPALIVE, 1)
|
if (process.env[opt]) {
|
||||||
sock.setsockopt(zmq.ZMQ_TCP_KEEPALIVE_IDLE, 300000)
|
try {
|
||||||
}
|
sock.setsockopt(zmq[opt], +process.env[opt])
|
||||||
catch (err) {
|
}
|
||||||
log.warn('ZeroMQ library too old, no support for TCP keepalive options')
|
catch (err) {
|
||||||
}
|
log.warn('ZeroMQ library too old, no support for %s', opt)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
return sock
|
return sock
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue