Skip to content
This repository was archived by the owner on Oct 30, 2023. It is now read-only.

Commit 387416e

Browse files
authored
Merge pull request #8 from FlowzPlatform/develop
data not uploaded start again job queue
2 parents 38a9634 + e75f19e commit 387416e

File tree

2 files changed

+13
-2
lines changed

2 files changed

+13
-2
lines changed

uploader.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ let ESClient = new elasticsearch.Client({
4848
requestTimeout: 100000
4949
// ,log: 'trace'
5050
})
51+
let uploadedRecord = 0
5152

5253
let optionsES = {
5354
tls: 'https://',
@@ -118,6 +119,10 @@ let doJob = async function (objWorkJob, next) {
118119

119120
function updateImportTrackerStatus (trackerId) {
120121
return new Promise(async (resolve, reject) => {
122+
if (uploadedRecord <=0) {
123+
reject({"message" :"data not uploaded, record count is zero"})
124+
}
125+
121126
rethinkDbConnectionObj = await connectRethinkDB(rethinkDBConnection)
122127
rethink.db(rethinkDBConnection.db).table(rethinkDBConnection.table)
123128
.filter({'id': trackerId})
@@ -506,7 +511,7 @@ let delayPromise = (delay) => {
506511

507512
let perPageDataUpload = 100
508513
let batchPromise = []
509-
let uploadedRecord = 0
514+
510515
// to make batch for data upload
511516
async function makeBatch (objWorkJob, listObjects, currentProductsData, makeProductUpdateJsonObj) {
512517
return new Promise(async (resolve, reject) => {

uploaderworker.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,18 @@ let queueOption = {
4444
}
4545

4646
process.on('unhandledRejection', (reason, p) => {
47-
console.log('Unhandled Rejection reason:', reason);
47+
console.log('Unhandled Rejection reason:', reason, p);
4848
// application specific logging, throwing an error, or other logic here
4949
});
5050

5151
const objQ = new rfqQueue(connctionOption, queueOption)
5252

53+
objQ.on('error', (err) => {
54+
console.log('Queue Id: ' + err.queueId)
55+
console.error(err)
56+
})
57+
58+
5359
function getJobQueue () {
5460
objQ.process(async (job, next) => {
5561
try {

0 commit comments

Comments
 (0)