Merge branch 'created_at-max-value' into 'main'
Enforce a created_at max value See merge request soapbox-pub/ditto!331
This commit is contained in:
commit
29a2a4ecdb
|
@ -115,6 +115,11 @@ async function storeEvent(event: DittoEvent, signal?: AbortSignal): Promise<void
|
||||||
const store = await Storages.db();
|
const store = await Storages.db();
|
||||||
const kysely = await DittoDB.getInstance();
|
const kysely = await DittoDB.getInstance();
|
||||||
|
|
||||||
|
// Integer max value for Postgres. TODO: switch to a bigint in 2038.
|
||||||
|
if (event.created_at >= 2_147_483_647) {
|
||||||
|
throw new RelayError('blocked', 'event too far in the future');
|
||||||
|
}
|
||||||
|
|
||||||
await updateStats({ event, store, kysely }).catch(debug);
|
await updateStats({ event, store, kysely }).catch(debug);
|
||||||
await store.event(event, { signal });
|
await store.event(event, { signal });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue