WIP more incoming tx logic
This commit is contained in:
parent
2e51bf646e
commit
d905b6898d
3 changed files with 99 additions and 18 deletions
|
|
@ -8,6 +8,9 @@ var POLLING_RATE = 60 * 1000; // poll each minute
|
|||
var REAP_RATE = 5 * 1000;
|
||||
var PENDING_TIMEOUT = 70 * 1000;
|
||||
|
||||
// TODO: might have to update this if user is allowed to extend monitoring time
|
||||
var DEPOSIT_TIMEOUT = 120 * 1000;
|
||||
|
||||
var db = null;
|
||||
|
||||
var tickerPlugin = null;
|
||||
|
|
@ -238,6 +241,10 @@ function reapTx(row) {
|
|||
}
|
||||
|
||||
function reapTxs() {
|
||||
db.removeOldPending(DEPOSIT_TIMEOUT);
|
||||
|
||||
// NOTE: No harm in processing old pending tx, we don't need to wait for
|
||||
// removeOldPending to complete.
|
||||
db.pendingTxs(PENDING_TIMEOUT, function(err, results) {
|
||||
if (err) return logger.warn(err);
|
||||
var rows = results.rows;
|
||||
|
|
@ -293,6 +300,11 @@ exports.cashOut = function cashOut(deviceFingerprint, tx, cb) {
|
|||
});
|
||||
};
|
||||
|
||||
exports.dispenseStatus = function dispenseStatus(deviceFingerprint, sessionId,
|
||||
cb) {
|
||||
db.fetchDispenseStatus(deviceFingerprint, sessionId, cb);
|
||||
};
|
||||
|
||||
exports.dispenseAck = function dispenseAck(deviceFingerprint, tx) {
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue