mirror of
https://github.com/jwinterm/nodejs-pool.git
synced 2026-10-17 05:21:27 +02:00
Resetting the setInterval system so it can't blow up in our faces.
This commit is contained in:
+7
-1
@@ -9,6 +9,7 @@ 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 paymentTimer = null;
|
||||
|
||||
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..
|
||||
@@ -292,6 +293,10 @@ let paymentQueue = async.queue(function (paymentDetails, callback) {
|
||||
support JSON URI: http://10.0.0.2:28082/json_rpc Args: {"id":"0","jsonrpc":"2.0","method":"transfer","params":{"destinations":[{"amount":68130252045355,"address":"A2MSrn49ziBPJBh8ZNEhhbfyLMou6mao4C1F5TLGUatmUnCxZArDYkcbAnVkVEopWVeak2rKDrmc8JpoS7n5dvfN9YDPBTG"}],"mixin":4,"payment_id":"7e52c5266de9fede7fb3abc0cd88f937b38b51426f7b34ff99729d28ce4e1142"}} +1ms
|
||||
payments Payment made: {"id":"0","jsonrpc":"2.0","result":{"fee":40199391255,"tx_hash":"c418708643f72635edf522490bfb2cae9d42a6dc1df30dcde844862dfd88f5b3","tx_key":""}} +2s
|
||||
*/
|
||||
if (paymentTimer !== null){
|
||||
paymentTimer.cancel();
|
||||
paymentTimer = null;
|
||||
}
|
||||
debug("Making payment based on: " + JSON.stringify(paymentDetails));
|
||||
let transferFunc = 'transfer';
|
||||
global.support.rpcWallet(transferFunc, paymentDetails, function (body) {
|
||||
@@ -337,6 +342,7 @@ let paymentQueue = async.queue(function (paymentDetails, callback) {
|
||||
|
||||
paymentQueue.drain = function(){
|
||||
extraPaymentRound = false;
|
||||
paymentTimer = setInterval(makePayments, 7200000);
|
||||
};
|
||||
|
||||
function updateShapeshiftCompletion() {
|
||||
@@ -677,7 +683,7 @@ function init() {
|
||||
});
|
||||
}, 60000);
|
||||
setInterval(determineBestExchange, 60000);
|
||||
setInterval(makePayments, 7200000);
|
||||
paymentTimer = setInterval(makePayments, 7200000);
|
||||
makePayments();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user