Skip to content

Commit

Permalink
fix(redis): add destination_id in the key
Browse files Browse the repository at this point in the history
while preparing the event for profiles<>redis store
  • Loading branch information
debanjan97 committed Sep 14, 2023
1 parent 9fc4545 commit f07e881
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/v0/destinations/redis/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ const isSubEventTypeProfiles = (message) => {
return sources.profiles_entity && sources.profiles_id_type && sources.profiles_model;
};

const transforrmSubEventTypeProfiles = (message, workspaceId) => {
const transformSubEventTypeProfiles = (message, workspaceId, destinationId) => {
// form the hash
const hash = `${workspaceId}:${message.context.sources.profiles_entity}:${message.context.sources.profiles_id_type}:${message.userId}`;
const hash = `${workspaceId}:${destinationId}:${message.context.sources.profiles_entity}:${message.context.sources.profiles_id_type}:${message.userId}`;
const key = `${message.context.sources.profiles_model}`;
const value = JSON.stringify(message.traits);
return {
Expand All @@ -59,11 +59,12 @@ const process = (event) => {
}

const { prefix } = destination.Config;
const destinationId = destination.ID;
const keyPrefix = isEmpty(prefix) ? '' : `${prefix.trim()}:`;

if (isSubEventTypeProfiles(message)) {
const { workspaceId } = metadata;
return transforrmSubEventTypeProfiles(message, workspaceId);
return transformSubEventTypeProfiles(message, workspaceId, destinationId);
}

const hmap = {
Expand Down

0 comments on commit f07e881

Please sign in to comment.