wip
This commit is contained in:
@@ -34,4 +34,8 @@ export async function getClientById(
|
||||
});
|
||||
}
|
||||
|
||||
export const getClientByIdCached = cacheable(getClientById, 60 * 60 * 24, true);
|
||||
export const getClientByIdCached = cacheable(
|
||||
getClientById,
|
||||
60 * 60 * 24,
|
||||
'both',
|
||||
);
|
||||
|
||||
@@ -340,7 +340,7 @@ export async function createEvent(payload: IServiceCreateEventPayload) {
|
||||
sdk_version: payload.sdkVersion ?? '',
|
||||
};
|
||||
|
||||
await Promise.all([sessionBuffer.add(event), eventBuffer.add(event)]);
|
||||
const promises = [sessionBuffer.add(event), eventBuffer.add(event)];
|
||||
|
||||
if (payload.profileId) {
|
||||
const profile: IServiceUpsertProfile = {
|
||||
@@ -371,10 +371,12 @@ export async function createEvent(payload: IServiceCreateEventPayload) {
|
||||
profile.isExternal ||
|
||||
(profile.isExternal === false && payload.name === 'session_start')
|
||||
) {
|
||||
await upsertProfile(profile, true);
|
||||
promises.push(upsertProfile(profile, true));
|
||||
}
|
||||
}
|
||||
|
||||
await Promise.all(promises);
|
||||
|
||||
return {
|
||||
document: event,
|
||||
};
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { generateSalt } from '@openpanel/common/server';
|
||||
|
||||
import { cacheable, getRedisCache } from '@openpanel/redis';
|
||||
import { cacheable } from '@openpanel/redis';
|
||||
import { db } from '../prisma-client';
|
||||
|
||||
export async function getCurrentSalt() {
|
||||
@@ -43,7 +43,7 @@ export const getSalts = cacheable(
|
||||
return salts;
|
||||
},
|
||||
60 * 10,
|
||||
true,
|
||||
'both',
|
||||
);
|
||||
|
||||
export async function createInitialSalts() {
|
||||
|
||||
Reference in New Issue
Block a user