improve real time speed

This commit is contained in:
Carl-Gerhard Lindesvärd
2024-08-12 22:45:00 +02:00
parent fdb3737659
commit 616afd0c06

View File

@@ -10,7 +10,7 @@ type Props = {
};
const RealtimeLiveEventsServer = async ({ projectId, limit = 30 }: Props) => {
const events = await getEvents(
`SELECT * FROM ${TABLE_NAMES.events} WHERE project_id = ${escape(projectId)} ORDER BY created_at DESC LIMIT ${limit}`,
`SELECT * FROM ${TABLE_NAMES.events} WHERE created_at > now() - INTERVAL 2 HOUR AND project_id = ${escape(projectId)} ORDER BY created_at DESC LIMIT ${limit}`,
{
profile: true,
}