fix get profile id function

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-08-09 21:45:06 +02:00
committed by Carl-Gerhard Lindesvärd
parent 887b187b3d
commit bda0204205
3 changed files with 5 additions and 7 deletions

View File

@@ -47,11 +47,10 @@ export async function incomingEvent(job: Job<EventsQueuePayloadIncomingEvent>) {
};
// this will get the profileId from the alias table if it exists
// const profileId = await getProfileIdCached({
// profileId: body.profileId,
// projectId,
// });
const profileId = body.profileId ? String(body.profileId) : '';
const profileId = await getProfileIdCached({
profileId: body.profileId,
projectId,
});
const createdAt = new Date(body.timestamp);
const url = getProperty('__path');
const { path, hash, query, origin } = parsePath(url);

View File

@@ -69,7 +69,7 @@ CREATE TABLE IF NOT EXISTS openpanel.profile_aliases (
`created_at` DateTime
) ENGINE = MergeTree
ORDER BY
(project_id, profile_id, alias) SETTINGS index_granularity = 8192;
(project_id, profile_id, alias, created_at) SETTINGS index_granularity = 8192;
--- Materialized views (DAU)
CREATE MATERIALIZED VIEW IF NOT EXISTS dau_mv ENGINE = AggregatingMergeTree() PARTITION BY toYYYYMMDD(date)

View File

@@ -54,7 +54,6 @@ export function cacheable<T extends (...args: any) => any>(
cachedFn.getKey = getKey;
cachedFn.clear = async function (...args: Parameters<T>) {
const key = getKey(...args);
console.log('[cachable] Clear', key);
return getRedisCache().del(key);
};