From b7dc672b50e8b18172140a1a657d51266513e610 Mon Sep 17 00:00:00 2001 From: Emmanuel Evance Date: Fri, 7 Jul 2023 12:14:53 +0300 Subject: [PATCH] increase pollTimeout --- bulk/bulkUpsert-Person.js | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/bulk/bulkUpsert-Person.js b/bulk/bulkUpsert-Person.js index 77ab1b2..2b065c7 100644 --- a/bulk/bulkUpsert-Person.js +++ b/bulk/bulkUpsert-Person.js @@ -8,7 +8,7 @@ fn(state => { caregiverMapping: [], sfRecordMapping: [], }; - // JSON logging of records + // JSON logging of records //console.log('cases before query :: ', JSON.stringify(state.payloads, null, 2)); const owner_ids = state.payloads.map(data => data.properties.owner_id); const uniq_owner_ids = [...new Set(owner_ids)]; @@ -42,9 +42,9 @@ fn(state => { : 0; //TODO: Update default value for 'unknown location' before go-live - return result.length > 0 ? result[0][arg] - : 'a000800001tMobaAAC' /*unknown location*/; - + return result.length > 0 + ? result[0][arg] + : 'a000800001tMobaAAC' /*unknown location*/; }; const cleanChoice = choice => { @@ -205,7 +205,7 @@ fn(state => { const householdMapping = [ ...new Map( state.payloads - /*HMN 05072023 + /*HMN 05072023 .filter( p => p.properties.commcare_username !== 'test.2021' && @@ -241,7 +241,7 @@ fn(state => { const motherMapping = state.payloads .filter( p => - /*HMN 050723 p.properties.commcare_username !== 'test.2021' && + /*HMN 050723 p.properties.commcare_username !== 'test.2021' && p.properties.test_user !== 'Yes' && */ p.properties.mother_case_id !== undefined && @@ -257,7 +257,7 @@ fn(state => { const caregiverMapping = state.payloads .filter( p => - /*HMN 070523 p.properties.commcare_username !== 'test.2021' && + /*HMN 070523 p.properties.commcare_username !== 'test.2021' && p.properties.test_user !== 'Yes' && */ p.properties.caretaker_case_id !== undefined && @@ -272,7 +272,7 @@ fn(state => { }); const sfRecordMapping = state.payloads - /*HMN 050723 .filter( + /*HMN 050723 .filter( p => p.properties.commcare_username !== 'test.2021' && p.properties.test_user !== 'Yes' @@ -383,9 +383,9 @@ fn(state => { }) : undefined; const reasonForNotTakingFP = rValue ? rValue.join(';') : undefined; - + const recordType = p.properties.Record_Type; - + return { // TODO @aleksa, Source__c is causing an error Source__c: true, @@ -417,9 +417,10 @@ fn(state => { Use_mosquito_net__c: p.properties.sleep_under_net, Birth_Certificate__c: p.properties.birth_certificate, Child_Status__c: childStatus, - 'RecordType.Name': recordType === 'Unborn' || recordType === '' - ? 'Child' - : recordType.toString().replace(/_/g, ' '), //convert Unborn children to Child RT + 'RecordType.Name': + recordType === 'Unborn' || recordType === '' + ? 'Child' + : recordType.toString().replace(/_/g, ' '), //convert Unborn children to Child RT //TT5 Mother Information =====================// MCH_booklet__c: p.properties.mch_booklet, Reason_for_not_taking_a_pregnancy_test__c: p.properties.No_Preg_Test @@ -690,10 +691,11 @@ bulk( extIdField: 'CommCare_ID__c', failOnError: true, allowNoOp: true, + pollTimeout: 360000, }, state => { console.log('Bulk upserting persons ::'); - //HMN commented this + //HMN commented this //console.log(JSON.stringify(state.sfRecordMapping, null, 2)); return state.sfRecordMapping; } @@ -721,6 +723,7 @@ bulk( extIdField: 'CommCare_ID__c', failOnError: true, allowNoOp: true, + pollTimeout: 360000, }, state => { console.log('Bulk upserting primary caregiver Persons ::'); @@ -751,6 +754,7 @@ bulk( extIdField: 'CommCare_ID__c', failOnError: true, allowNoOp: true, + pollTimeout: 360000, }, state => { console.log('Bulk upserting mother Person::'); @@ -785,6 +789,7 @@ bulk( failOnError: true, allowNoOp: true, concurrencyMode: 'serial', + pollTimeout: 360000, }, state => { console.log('Bulk upserting head of household field on HH ::');