@@ -16,8 +16,10 @@ const port = 3000
16
16
//===============RECONSILER2 DYNAMODB CODE STARTS HERE ==========================
17
17
18
18
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
21
23
}
22
24
23
25
var docClient = new AWS . DynamoDB . DocumentClient ( {
@@ -38,7 +40,7 @@ ElapsedTime = config.DYNAMODB.DD_ElapsedTime
38
40
}
39
41
}
40
42
41
- function onScan ( err , data ) {
43
+ async function onScan ( err , data ) {
42
44
if ( err ) {
43
45
logger . error ( "Unable to scan the table. Error JSON:" , JSON . stringify ( err , null , 2 ) ) ;
44
46
terminate ( )
@@ -71,7 +73,7 @@ function onScan(err, data) {
71
73
if ( typeof data . LastEvaluatedKey != "undefined" ) {
72
74
console . log ( "Scanning for more..." ) ;
73
75
params . ExclusiveStartKey = data . LastEvaluatedKey ;
74
- docClient . scan ( params , onScan ) ;
76
+ await docClient . scan ( params , onScan ) ;
75
77
}
76
78
else
77
79
{
@@ -117,7 +119,9 @@ async function verify_pg_record_exists(seqid)
117
119
pgClient . end ( )
118
120
pgClient = null
119
121
} )
120
- } ) }
122
+ } )
123
+ return
124
+ }
121
125
catch ( err ) {
122
126
const errmsg = `error-sync: Reconsiler2 : Error in setting up postgres client: "${ err . message } "`
123
127
logger . error ( errmsg )
0 commit comments