1
0
Fork 0
mirror of https://github.com/openstf/stf synced 2025-10-04 18:29:17 +02:00

Make all zmq endpoints use srv records.

This commit is contained in:
Simo Kinnunen 2014-12-17 21:01:20 +09:00
parent f0aae7d4e5
commit e43ae34d4b
8 changed files with 118 additions and 32 deletions

View file

@ -1,8 +1,10 @@
var syrup = require('stf-syrup')
var zmq = require('zmq')
var Promise = require('bluebird')
var logger = require('../../../util/logger')
var srv = require('../../../util/srv')
module.exports = syrup.serial()
.define(function(options) {
@ -10,9 +12,14 @@ module.exports = syrup.serial()
// Output
var push = zmq.socket('push')
options.endpoints.push.forEach(function(endpoint) {
log.info('Sending output to %s', endpoint)
push.connect(endpoint)
Promise.map(options.endpoints.push, function(endpoint) {
return srv.resolve(endpoint).then(function(records) {
return srv.attempt(records, function(record) {
log.info('Sending output to "%s"', record.url)
push.connect(record.url)
return Promise.resolve(true)
})
})
})
return push