Skip to content

Commit

Permalink
streaming
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 committed Apr 5, 2024
1 parent 423ee9f commit 5b67ee7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/services/suspend-user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@ export async function doPostSuspend(user: User) {
.orWhere({ followeeSharedInbox: Not(IsNull()) })
));

/*
for (const row of await query.getRawMany()) {
deliver(user as any, content, row.inbox);
}
*/

/* streaming ここまでいらないと思うが
async function ProcessStreamingRow<T> (query: SelectQueryBuilder<T>, callback: (row: Record<string, unknown>) => Promise<void>) {
async function ProcessStreamingRows<T> (query: SelectQueryBuilder<T>, callback: (row: Record<string, unknown>) => Promise<void>) {
return new Promise(async (res, rej) => {
// query and get stream
let stream: ReadStream;
Expand All @@ -51,13 +52,16 @@ export async function doPostSuspend(user: User) {
});
}

await ProcessStreamingRow(query, async row => {
await ProcessStreamingRows(query, async (row: Record<string, unknown>) => {
if (typeof row.inbox === 'string') {
deliver(user as any, content, row.inbox);
try {
await deliver(user as any, content, row.inbox);
} catch (e) {
console.warn('mmm');
}
} else {
console.warn('nnn');
}
});
*/
}
}

0 comments on commit 5b67ee7

Please sign in to comment.