Pass Request signal down from API controllers

This commit is contained in:
Alex Gleason
2024-01-23 15:53:29 -06:00
parent 77f2e2d940
commit 5b24b7ad39
26 changed files with 81 additions and 59 deletions

View File

@@ -6,10 +6,11 @@ import { renderNotification } from '@/views/mastodon/notifications.ts';
const notificationsController: AppController = async (c) => {
const pubkey = c.get('pubkey')!;
const { since, until } = paginationSchema.parse(c.req.query());
const { signal } = c.req.raw;
const events = await eventsDB.query(
[{ kinds: [1], '#p': [pubkey], since, until }],
{ signal: AbortSignal.timeout(3000) },
{ signal },
);
const statuses = await Promise.all(events.map((event) => renderNotification(event, pubkey)));