feat:抢单大厅数据排列优化
This commit is contained in:
@@ -62,10 +62,13 @@ export async function createRealtimeEvent(input: {
|
||||
export async function listRealtimeEventsAfter(eventId: number, limit = 500) {
|
||||
const result = await query<RealtimeEventRow>(
|
||||
`
|
||||
SELECT * FROM realtime_events
|
||||
WHERE id > $1
|
||||
SELECT * FROM (
|
||||
SELECT * FROM realtime_events
|
||||
WHERE id > $1
|
||||
ORDER BY id DESC
|
||||
LIMIT $2
|
||||
) replay_window
|
||||
ORDER BY id ASC
|
||||
LIMIT $2
|
||||
`,
|
||||
[Math.max(0, Number(eventId) || 0), Math.min(500, Math.max(1, Number(limit) || 500))],
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user