mirror of
https://github.com/jwinterm/nodejs-pool.git
synced 2026-12-01 11:43:58 +01:00
We needed to be slightly more careful with this. Now we are!
This commit is contained in:
+8
-2
@@ -8,6 +8,7 @@ const range = require('range');
|
|||||||
let hexChars = new RegExp("[0-9a-f]+");
|
let hexChars = new RegExp("[0-9a-f]+");
|
||||||
let bestExchange = global.config.payout.bestExchange;
|
let bestExchange = global.config.payout.bestExchange;
|
||||||
let xmrAPIClient = request.createClient('https://xmr.to/api/v1/xmr2btc/');
|
let xmrAPIClient = request.createClient('https://xmr.to/api/v1/xmr2btc/');
|
||||||
|
let extraPaymentRound = false;
|
||||||
|
|
||||||
let shapeshiftQueue = async.queue(function (task, callback) {
|
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..
|
// 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.hasOwnProperty('error')) {
|
||||||
if (body.error.message === "not enough money"){
|
if (body.error.message === "not enough money"){
|
||||||
console.error("Issue making payments, not enough money, will try later");
|
console.error("Issue making payments, not enough money, will try later");
|
||||||
if (!paymentDetails.hasOwnProperty('payment_id')) {
|
if(!extraPaymentRound){
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
paymentQueue.push(paymentDetails, callback);
|
makePayments();
|
||||||
}, 1800000);
|
}, 1800000);
|
||||||
}
|
}
|
||||||
|
extraPaymentRound = true;
|
||||||
return callback(false);
|
return callback(false);
|
||||||
} else {
|
} else {
|
||||||
console.error("Issue making payments" + JSON.stringify(body.error));
|
console.error("Issue making payments" + JSON.stringify(body.error));
|
||||||
@@ -333,6 +335,10 @@ let paymentQueue = async.queue(function (paymentDetails, callback) {
|
|||||||
});
|
});
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|
||||||
|
paymentQueue.drain = function(){
|
||||||
|
extraPaymentRound = false;
|
||||||
|
};
|
||||||
|
|
||||||
function updateShapeshiftCompletion() {
|
function updateShapeshiftCompletion() {
|
||||||
global.mysql.query("SELECT * FROM shapeshiftTxn WHERE txnStatus NOT IN ('complete', 'error')").then(function (rows) {
|
global.mysql.query("SELECT * FROM shapeshiftTxn WHERE txnStatus NOT IN ('complete', 'error')").then(function (rows) {
|
||||||
rows.forEach(function (row) {
|
rows.forEach(function (row) {
|
||||||
|
|||||||
Reference in New Issue
Block a user