use primary for reading eventbuffer

This commit is contained in:
Carl-Gerhard Lindesvärd
2025-02-04 16:51:18 +01:00
parent cc1f4aa625
commit c2d2f64fc3
2 changed files with 9 additions and 1 deletions

View File

@@ -245,13 +245,16 @@ export class EventBuffer extends BaseBuffer {
projectId: string;
profileId: string;
}): Promise<IServiceEvent | null> {
const event = await db.eventBuffer.findFirst({
const event = await db.$primary().eventBuffer.findFirst({
where: {
projectId,
profileId,
name: 'screen_view',
},
orderBy: { createdAt: 'desc' },
select: {
payload: true,
},
});
if (event) {

View File

@@ -122,6 +122,11 @@ export class ProfileBuffer extends BaseBuffer {
orderBy: {
createdAt: 'desc',
},
select: {
checksum: true,
payload: true,
id: true,
},
});
// Last item in buffer is the same as the new profile