diff --git a/apps/worker/src/jobs/events.incoming-event.ts b/apps/worker/src/jobs/events.incoming-event.ts index 0970c47a..80e15641 100644 --- a/apps/worker/src/jobs/events.incoming-event.ts +++ b/apps/worker/src/jobs/events.incoming-event.ts @@ -47,11 +47,10 @@ export async function incomingEvent(job: Job) { }; // 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); diff --git a/packages/db/clickhouse_init.sql b/packages/db/clickhouse_init.sql index d4210fa6..bb32ca3f 100644 --- a/packages/db/clickhouse_init.sql +++ b/packages/db/clickhouse_init.sql @@ -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) diff --git a/packages/redis/cachable.ts b/packages/redis/cachable.ts index c171aec9..d39c48fa 100644 --- a/packages/redis/cachable.ts +++ b/packages/redis/cachable.ts @@ -54,7 +54,6 @@ export function cacheable any>( cachedFn.getKey = getKey; cachedFn.clear = async function (...args: Parameters) { const key = getKey(...args); - console.log('[cachable] Clear', key); return getRedisCache().del(key); };