Skip to content

Commit

Permalink
fix: redundant pass, console.log
Browse files Browse the repository at this point in the history
  • Loading branch information
yashasvibajpai committed May 4, 2023
1 parent fa642be commit 618bf87
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 21 deletions.
18 changes: 3 additions & 15 deletions src/v0/destinations/braze/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,21 +148,6 @@ function getUserAttributesObject(message, mappingJson, destination) {
return traits;
}

// iterate over the destKeys and set the value if present
Object.keys(mappingJson).forEach((destKey) => {
let value = get(traits, mappingJson[destKey]);
if (value) {
// handle gender special case
if (destKey === 'gender') {
value = formatGender(value);
}
if (destKey === 'email') {
value = value.toLowerCase();
}
data[destKey] = value;
}
});

// reserved keys : already mapped through mappingJson
const reservedKeys = [
'address',
Expand All @@ -185,6 +170,9 @@ function getUserAttributesObject(message, mappingJson, destination) {
if (destKey === 'gender') {
value = formatGender(value);
}
if (destKey === 'email') {
value = value.toLowerCase();
}
data[destKey] = value;
}
});
Expand Down
6 changes: 0 additions & 6 deletions src/v0/destinations/braze/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,6 @@ const BrazeDedupUtility = {
const externalIdentifiers = ids.filter((id) => id.external_id);
const aliasIdentifiers = ids.filter((id) => id.alias_name !== undefined);

const startTime = Date.now();
const { processedResponse: lookUpResponse } = await handleHttpRequest(
'post',
`${getEndpointFromConfig(destination)}/users/export/ids`,
Expand All @@ -146,11 +145,6 @@ const BrazeDedupUtility = {
timeout: 10 * 1000,
},
);
const endTime = Date.now();
// TODO: Remove this log
console.log(
`Time taken to fetch user store: ${endTime - startTime} ms for ${ids.length} users`,
);
stats.counter('braze_lookup_failure_count', 1, { http_status: lookUpResponse.status });
const { users } = lookUpResponse.response;

Expand Down

0 comments on commit 618bf87

Please sign in to comment.