Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

increase pollTimeout #114

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 21 additions & 14 deletions bulk/bulkUpsert-Person.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ fn(state => {
caregiverMapping: [],
sfRecordMapping: [],
};
// JSON logging of records
//HMN debug

// 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)];
Expand Down Expand Up @@ -43,9 +43,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 => {
Expand Down Expand Up @@ -206,6 +206,7 @@ fn(state => {
const householdMapping = [
...new Map(
state.payloads

.filter(
p =>
p.indices.parent.case_id !== undefined &&
Expand Down Expand Up @@ -238,7 +239,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 &&
Expand All @@ -255,7 +256,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 &&
Expand All @@ -271,6 +272,7 @@ fn(state => {
});

const sfRecordMapping = state.payloads

.filter(
p =>
/*HMN 050723
Expand Down Expand Up @@ -390,10 +392,9 @@ console.log(p.case_id)
})
: 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,
Expand Down Expand Up @@ -426,9 +427,10 @@ console.log(p.case_id)
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
Expand Down Expand Up @@ -700,10 +702,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;
}
Expand Down Expand Up @@ -731,6 +734,7 @@ bulk(
extIdField: 'CommCare_ID__c',
failOnError: true,
allowNoOp: true,
pollTimeout: 360000,
},
state => {
console.log('Bulk upserting primary caregiver Persons ::');
Expand Down Expand Up @@ -761,6 +765,7 @@ bulk(
extIdField: 'CommCare_ID__c',
failOnError: true,
allowNoOp: true,
pollTimeout: 360000,
},
state => {
console.log('Bulk upserting mother Person::');
Expand Down Expand Up @@ -794,6 +799,8 @@ bulk(
extIdField: 'CommCare_Code__c',
failOnError: true,
allowNoOp: true,
concurrencyMode: 'serial',
pollTimeout: 360000,
},
state => {
console.log('Bulk upserting head of household field on HH ::');
Expand Down