Remove SQLite support

This commit is contained in:
Alex Gleason
2024-09-11 11:08:33 -05:00
parent f76d0af16d
commit dc8d09a9da
28 changed files with 156 additions and 568 deletions

View File

@@ -17,7 +17,7 @@ export class SimpleLRU<
constructor(fetchFn: FetchFn<K, V, { signal: AbortSignal }>, opts: LRUCache.Options<K, V, void>) {
this.cache = new LRUCache({
fetchMethod: (key, _staleValue, { signal }) => fetchFn(key, { signal: signal as AbortSignal }),
fetchMethod: (key, _staleValue, { signal }) => fetchFn(key, { signal: signal as unknown as AbortSignal }),
...opts,
});
}

View File

@@ -5,7 +5,6 @@ import { z } from 'zod';
import { DittoTables } from '@/db/DittoTables.ts';
import { findQuoteTag, findReplyTag, getTagSet } from '@/utils/tags.ts';
import { Conf } from '@/config.ts';
interface UpdateStatsOpts {
kysely: Kysely<DittoTables>;
@@ -197,16 +196,13 @@ export async function updateAuthorStats(
notes_count: 0,
};
let query = kysely
const prev = await kysely
.selectFrom('author_stats')
.selectAll()
.where('pubkey', '=', pubkey);
.forUpdate()
.where('pubkey', '=', pubkey)
.executeTakeFirst();
if (Conf.db.dialect === 'postgres') {
query = query.forUpdate();
}
const prev = await query.executeTakeFirst();
const stats = fn(prev ?? empty);
if (prev) {
@@ -249,16 +245,13 @@ export async function updateEventStats(
reactions: '{}',
};
let query = kysely
const prev = await kysely
.selectFrom('event_stats')
.selectAll()
.where('event_id', '=', eventId);
.forUpdate()
.where('event_id', '=', eventId)
.executeTakeFirst();
if (Conf.db.dialect === 'postgres') {
query = query.forUpdate();
}
const prev = await query.executeTakeFirst();
const stats = fn(prev ?? empty);
if (prev) {