make requestPending into HTTP error to work with l-m retry
This commit is contained in:
parent
1d323b0647
commit
25d782a2c5
2 changed files with 6 additions and 3 deletions
|
|
@ -583,8 +583,7 @@ function updateDispense (client, session, dispensed, cb) {
|
||||||
var values = [dispensed, 'initial_request', 'pending', session.fingerprint, session.id, true]
|
var values = [dispensed, 'initial_request', 'pending', session.fingerprint, session.id, true]
|
||||||
query(client, sql, values, function (err, results) {
|
query(client, sql, values, function (err, results) {
|
||||||
if (err) return cb(err)
|
if (err) return cb(err)
|
||||||
// DEBUG10
|
if (results.rowCount === 0) return cb(new Error('No pending tx'))
|
||||||
// if (results.rowCount === 0) return cb(new Error('No pending tx'))
|
|
||||||
cb()
|
cb()
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -360,7 +360,11 @@ function getFingerprint (req) {
|
||||||
|
|
||||||
function cachedResponse (req, res, next) {
|
function cachedResponse (req, res, next) {
|
||||||
return plugins.cachedResponse(session(req), req.path, req.method)
|
return plugins.cachedResponse(session(req), req.path, req.method)
|
||||||
.then(r => r.body ? res.json(r.body) : next())
|
.then(r => {
|
||||||
|
if (!r.body) return next()
|
||||||
|
if (r.body.pendingRequest) return res.sendStatus(409)
|
||||||
|
res.json(r.body)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function cacheResponse (req, body) {
|
function cacheResponse (req, body) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue