var transactionData = require('../models/transactionData.js');
var sqsHelper = require('../helpers/aws/sqsHelper.js');
var schedule = require('node-schedule');

var job = schedule.scheduleJob('*/1 * * * *', function(){
	transactionData.readUnfinishedTransaction().then(function(result) {
		if (result.rowCount > 0) {
			result.rows.forEach(function(item){
				var message = {
					"txHash": item.txhash,
					"contractId": item.contractid,
					"contractFunctionId": item.contractfunctionid,
					"data": JSON.parse(item.data)
				};
				sqsHelper.send(JSON.stringify(message), 
					process.env.AWS_TRANSACTION_QUEUE_URL, 10, 
					'transaction');
			});
		}
	}).catch(function(err){
		console.log(err.message, err.stack);
	});
});

var transactionData = require('../models/transactionData.js');
var sqsHelper = require('../helpers/aws/sqsHelper.js');
var schedule = require('node-schedule');

var job = schedule.scheduleJob('*/10 * * * *', function(){
	transactionData.readUnfinishedTransaction().then(function(result) {
		if (result.rowCount > 0) {
			result.rows.forEach(function(item){
				var message = {
					"txHash": item.txhash,
					"contractId": item.contractid,
					"contractFunctionId": item.contractfunctionid,
					"data": JSON.parse(item.data)
				};
				sqsHelper.send(JSON.stringify(message), 
					process.env.AWS_TRANSACTION_QUEUE_URL, 10, 
					'transaction');
			});
		}
	}).catch(function(err){
		console.log(err.message, err.stack);
	});
});

Add scheduler for running unfinish transaction
[Core] Add scheduler for running unfinish transaction
