We needed to be slightly more careful with this. Now we are!
This commit is contained in:
parent
cc2bfffe07
commit
d0e15f7e1f
1 changed files with 8 additions and 2 deletions
|
|
@ -8,6 +8,7 @@ const range = require('range');
|
|||
let hexChars = new RegExp("[0-9a-f]+");
|
||||
let bestExchange = global.config.payout.bestExchange;
|
||||
let xmrAPIClient = request.createClient('https://xmr.to/api/v1/xmr2btc/');
|
||||
let extraPaymentRound = false;
|
||||
|
||||
let shapeshiftQueue = async.queue(function (task, callback) {
|
||||
// Amount needs to be shifted in as a non-completed value, as the wallet will only take non-complete values..
|
||||
|
|
@ -298,11 +299,12 @@ let paymentQueue = async.queue(function (paymentDetails, callback) {
|
|||
if (body.hasOwnProperty('error')) {
|
||||
if (body.error.message === "not enough money"){
|
||||
console.error("Issue making payments, not enough money, will try later");
|
||||
if (!paymentDetails.hasOwnProperty('payment_id')) {
|
||||
if(!extraPaymentRound){
|
||||
setTimeout(function(){
|
||||
paymentQueue.push(paymentDetails, callback);
|
||||
makePayments();
|
||||
}, 1800000);
|
||||
}
|
||||
extraPaymentRound = true;
|
||||
return callback(false);
|
||||
} else {
|
||||
console.error("Issue making payments" + JSON.stringify(body.error));
|
||||
|
|
@ -333,6 +335,10 @@ let paymentQueue = async.queue(function (paymentDetails, callback) {
|
|||
});
|
||||
}, 1);
|
||||
|
||||
paymentQueue.drain = function(){
|
||||
extraPaymentRound = false;
|
||||
};
|
||||
|
||||
function updateShapeshiftCompletion() {
|
||||
global.mysql.query("SELECT * FROM shapeshiftTxn WHERE txnStatus NOT IN ('complete', 'error')").then(function (rows) {
|
||||
rows.forEach(function (row) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue