Minor refactoring

This commit is contained in:
Alex Gleason 2023-08-08 19:31:14 -05:00
parent 295b16e943
commit cd68da5b93
No known key found for this signature in database
GPG Key ID: 7211D1F99744FBB7
3 changed files with 4 additions and 3 deletions

View File

@ -49,6 +49,7 @@ const migrator = new Migrator({
});
console.log('Running migrations...');
await migrator.migrateToLatest();
const results = await migrator.migrateToLatest();
console.log('Migrations finished:', results);
export { db, type EventRow, type TagRow, type UserRow };

View File

@ -35,7 +35,7 @@ function insertEvent(event: SignedEvent): Promise<void> {
}
async function getFilter<K extends number = number>(filter: Filter<K>): Promise<SignedEvent<K>[]> {
let query = db.selectFrom('events').selectAll();
let query = db.selectFrom('events').selectAll().orderBy('created_at', 'desc');
for (const key of Object.keys(filter)) {
switch (key as keyof Filter) {

View File

@ -22,7 +22,7 @@ relay.subscribe(
/** Handle events through the loopback pipeline. */
function handleEvent(event: SignedEvent): void {
console.info('loopback event:', event.id);
insertEvent(event);
insertEvent(event).catch(console.warn);
trackHashtags(event);
}