mirror of
https://github.com/openstf/stf
synced 2025-10-05 19:42:01 +02:00
Use wireutil.reply() where possible.
This commit is contained in:
parent
90b39306a8
commit
7f74ecd7af
8 changed files with 32 additions and 128 deletions
|
@ -15,7 +15,6 @@ var zmq = require('zmq')
|
|||
var logger = require('../../util/logger')
|
||||
var requtil = require('../../util/requtil')
|
||||
var Storage = require('../../util/storage')
|
||||
var wire = require('../../wire')
|
||||
var wireutil = require('../../wire/util')
|
||||
|
||||
module.exports = function(options) {
|
||||
|
@ -129,18 +128,13 @@ module.exports = function(options) {
|
|||
}
|
||||
|
||||
app.post('/api/v1/resources', function(req, res) {
|
||||
var seq = 0
|
||||
var reply = wireutil.reply(options.id)
|
||||
|
||||
function sendProgress(data, progress) {
|
||||
if (req.query.channel) {
|
||||
push.send([
|
||||
req.query.channel
|
||||
, wireutil.envelope(new wire.TransactionProgressMessage(
|
||||
options.id
|
||||
, seq++
|
||||
, data
|
||||
, progress
|
||||
))
|
||||
, reply.progress(data, progress)
|
||||
])
|
||||
}
|
||||
}
|
||||
|
@ -149,13 +143,7 @@ module.exports = function(options) {
|
|||
if (req.query.channel) {
|
||||
push.send([
|
||||
req.query.channel
|
||||
, wireutil.envelope(new wire.TransactionDoneMessage(
|
||||
options.id
|
||||
, seq++
|
||||
, success
|
||||
, data
|
||||
, body ? JSON.stringify(body) : null
|
||||
))
|
||||
, reply.okay(data, body)
|
||||
])
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue