fix: require async for deliver queue
All checks were successful
ci/woodpecker/push/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/build Pipeline was successful
ci/woodpecker/push/lint-sw Pipeline was successful
ci/woodpecker/pr/lint-sw Pipeline was successful
ci/woodpecker/pr/test Pipeline was successful
ci/woodpecker/push/test Pipeline was successful
ci/woodpecker/push/lint-client Pipeline was successful
ci/woodpecker/push/build Pipeline was successful
ci/woodpecker/push/lint-backend Pipeline was successful
ci/woodpecker/pr/lint-backend Pipeline was successful
ci/woodpecker/pr/lint-foundkey-js Pipeline was successful
ci/woodpecker/pr/lint-client Pipeline was successful

This commit is contained in:
Johann150 2023-05-04 21:43:09 +02:00
parent 7f7fbc291e
commit e574d9cef1
Signed by: Johann150
GPG key ID: 9EE6577A2A06F8F1
10 changed files with 17 additions and 17 deletions

View file

@ -29,7 +29,7 @@ export default define(meta, paramDef, async (ps, me) => {
const actor = await getInstanceActor(); const actor = await getInstanceActor();
const targetUser = await Users.findOneByOrFail({ id: report.targetUserId }); const targetUser = await Users.findOneByOrFail({ id: report.targetUserId });
deliver(renderActivity(renderFlag(actor, report)), targetUser.inbox); await deliver(renderActivity(renderFlag(actor, report)), targetUser.inbox);
} }
await AbuseUserReports.update(report.id, { await AbuseUserReports.update(report.id, {

View file

@ -133,7 +133,7 @@ export default define(meta, paramDef, async (ps, user) => {
if (note.userHost != null) { if (note.userHost != null) {
const pollOwner = await Users.findOneByOrFail({ id: note.userId }) as IRemoteUser; const pollOwner = await Users.findOneByOrFail({ id: note.userId }) as IRemoteUser;
deliver(renderActivity(await renderVote(user, vote, note, poll, pollOwner)), pollOwner.inbox); await deliver(renderActivity(await renderVote(user, vote, note, poll, pollOwner)), pollOwner.inbox);
} }
// リモートフォロワーにUpdate配信 // リモートフォロワーにUpdate配信

View file

@ -29,6 +29,6 @@ export default async function(blocker: User, blockee: User) {
// deliver if remote bloking // deliver if remote bloking
if (Users.isLocalUser(blocker) && Users.isRemoteUser(blockee)) { if (Users.isLocalUser(blocker) && Users.isRemoteUser(blockee)) {
const content = renderActivity(renderUndo(renderBlock(blocking), blocker)); const content = renderActivity(renderUndo(renderBlock(blocking), blocker));
deliver(content, blockee.inbox); await deliver(content, blockee.inbox);
} }
} }

View file

@ -27,7 +27,7 @@ export async function acceptFollowRequest(followee: User, follower: User): Promi
if (Users.isRemoteUser(follower) && Users.isLocalUser(followee)) { if (Users.isRemoteUser(follower) && Users.isLocalUser(followee)) {
const content = renderActivity(renderAccept(renderFollow(follower, followee, request.requestId!), followee)); const content = renderActivity(renderAccept(renderFollow(follower, followee, request.requestId!), followee));
deliver(content, follower.inbox); await deliver(content, follower.inbox);
} }
Users.pack(followee.id, followee, { Users.pack(followee.id, followee, {

View file

@ -17,7 +17,7 @@ export async function cancelFollowRequest(followee: User, follower: User): Promi
const content = renderActivity(renderUndo(renderFollow(follower, followee), follower)); const content = renderActivity(renderUndo(renderFollow(follower, followee), follower));
if (Users.isLocalUser(follower)) { if (Users.isLocalUser(follower)) {
deliver(content, followee.inbox); await deliver(content, followee.inbox);
} }
} }

View file

@ -64,6 +64,6 @@ export async function createFollowRequest(follower: User, followee: User, reques
if (Users.isLocalUser(follower) && Users.isRemoteUser(followee)) { if (Users.isLocalUser(follower) && Users.isRemoteUser(followee)) {
const content = renderActivity(renderFollow(follower, followee)); const content = renderActivity(renderFollow(follower, followee));
deliver(content, followee.inbox); await deliver(content, followee.inbox);
} }
} }

View file

@ -97,7 +97,7 @@ export async function createMessage(user: { id: User['id']; host: User['host'];
const activity = renderActivity(renderCreate(await renderNote(note, false, true), note)); const activity = renderActivity(renderCreate(await renderNote(note, false, true), note));
deliver(activity, recipientUser.inbox); await deliver(activity, recipientUser.inbox);
} }
return messageObj; return messageObj;
} }

View file

@ -22,7 +22,7 @@ async function postDeleteMessage(message: MessagingMessage): Promise<void> {
if (Users.isLocalUser(user) && Users.isRemoteUser(recipient)) { if (Users.isLocalUser(user) && Users.isRemoteUser(recipient)) {
const activity = renderActivity(renderDelete(renderTombstone(`${config.url}/notes/${message.id}`), user)); const activity = renderActivity(renderDelete(renderTombstone(`${config.url}/notes/${message.id}`), user));
deliver(activity, recipient.inbox); await deliver(activity, recipient.inbox);
} }
} else if (message.groupId) { } else if (message.groupId) {
publishGroupMessagingStream(message.groupId, 'deleted', message.id); publishGroupMessagingStream(message.groupId, 'deleted', message.id);

View file

@ -37,7 +37,7 @@ export async function addRelay(inbox: string): Promise<Relay> {
const relayActor = await getRelayActor(); const relayActor = await getRelayActor();
const activity = renderActivity(renderFollowRelay(relay, relayActor)); const activity = renderActivity(renderFollowRelay(relay, relayActor));
deliver(activity, relay.inbox); await deliver(activity, relay.inbox);
return relay; return relay;
} }
@ -53,7 +53,7 @@ export async function removeRelay(inbox: string): Promise<void> {
const relayActor = await getRelayActor(); const relayActor = await getRelayActor();
const activity = renderActivity(renderUndo(renderFollowRelay(relay, relayActor), relayActor)); const activity = renderActivity(renderUndo(renderFollowRelay(relay, relayActor), relayActor));
deliver(activity, relay.inbox); await deliver(activity, relay.inbox);
await Relays.delete(relay.id); await Relays.delete(relay.id);
} }
@ -89,9 +89,9 @@ export async function deliverToRelays(user: { id: User['id']; host: null; }, act
const signed = await attachLdSignature(copy, user); const signed = await attachLdSignature(copy, user);
for (const relay of relays) { await Promise.all(relays.map(relay =>
deliver(signed, relay.inbox); deliver(signed, relay.inbox)
} ));
} }
export async function deliverMultipleToRelays(user: User, activities: any[]): Promise<void> { export async function deliverMultipleToRelays(user: User, activities: any[]): Promise<void> {
@ -107,7 +107,7 @@ export async function deliverMultipleToRelays(user: User, activities: any[]): Pr
return attachLdSignature(copy, user); return attachLdSignature(copy, user);
})); }));
for (const relay of relays) { await Promise.all(relays.map(relay =>
deliver(content, relay.inbox); deliver(content, relay.inbox)
} ));
} }

View file

@ -32,7 +32,7 @@ export async function doPostUnsuspend(user: User): Promise<void> {
} }
for (const inbox of queue) { for (const inbox of queue) {
deliver(content, inbox); await deliver(content, inbox);
} }
} }
} }