Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit effe366

Browse files
authoredJun 22, 2020
Update reconsiler-dd.js
1 parent 7decc04 commit effe366

File tree

1 file changed

+9
-5
lines changed

1 file changed

+9
-5
lines changed
 

‎src/reconsiler-dd.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,10 @@ const port = 3000
1616
//===============RECONSILER2 DYNAMODB CODE STARTS HERE ==========================
1717

1818
async function callReconsiler2()
19-
{console.log("inside 2");
20-
docClient.scan(params, onScan);
19+
{
20+
console.log("inside 2");
21+
await docClient.scan(params, onScan);
22+
return
2123
}
2224

2325
var docClient = new AWS.DynamoDB.DocumentClient({
@@ -38,7 +40,7 @@ ElapsedTime = config.DYNAMODB.DD_ElapsedTime
3840
}
3941
}
4042

41-
function onScan(err, data) {
43+
async function onScan(err, data) {
4244
if (err) {
4345
logger.error("Unable to scan the table. Error JSON:", JSON.stringify(err, null, 2));
4446
terminate()
@@ -71,7 +73,7 @@ function onScan(err, data) {
7173
if (typeof data.LastEvaluatedKey != "undefined") {
7274
console.log("Scanning for more...");
7375
params.ExclusiveStartKey = data.LastEvaluatedKey;
74-
docClient.scan(params, onScan);
76+
await docClient.scan(params, onScan);
7577
}
7678
else
7779
{
@@ -117,7 +119,9 @@ async function verify_pg_record_exists(seqid)
117119
pgClient.end()
118120
pgClient = null
119121
})
120-
})}
122+
})
123+
return
124+
}
121125
catch (err) {
122126
const errmsg = `error-sync: Reconsiler2 : Error in setting up postgres client: "${err.message}"`
123127
logger.error(errmsg)

0 commit comments

Comments
 (0)
Please sign in to comment.