fix: don't use Task.WhenAll() in message responders, it breaks ignoring them for some reason

This commit is contained in:
sam 2024-10-29 15:24:32 +01:00
parent be8bc9b199
commit 8ae4ba722a
Signed by: sam
GPG key ID: 5F3C3C1B3166639D
2 changed files with 26 additions and 22 deletions

View file

@ -148,16 +148,20 @@ public partial class PkMessageHandler(ILogger logger, IServiceProvider services)
await using var messageRepository =
scope.ServiceProvider.GetRequiredService<MessageRepository>();
await Task.WhenAll(
messageRepository.SetProxiedMessageDataAsync(
_logger.Debug(
"Setting proxy data for {MessageId} and ignoring {OriginalId}",
msgId,
originalId
);
await messageRepository.SetProxiedMessageDataAsync(
msgId,
originalId,
authorId,
systemId: match.Groups[1].Value,
memberId: match.Groups[2].Value
),
messageRepository.IgnoreMessageAsync(originalId)
);
await messageRepository.IgnoreMessageAsync(originalId);
}
public async Task HandleProxiedMessageAsync(ulong msgId)
@ -189,15 +193,19 @@ public partial class PkMessageHandler(ILogger logger, IServiceProvider services)
return;
}
await Task.WhenAll(
messageRepository.SetProxiedMessageDataAsync(
_logger.Debug(
"Setting proxy data for {MessageId} and ignoring {OriginalId}",
msgId,
pkMessage.Original
);
await messageRepository.SetProxiedMessageDataAsync(
msgId,
pkMessage.Original,
pkMessage.Sender,
pkMessage.System?.Id,
pkMessage.Member?.Id
),
messageRepository.IgnoreMessageAsync(pkMessage.Original)
);
await messageRepository.IgnoreMessageAsync(pkMessage.Original);
}
}

View file

@ -37,8 +37,4 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="6.8.1"/>
</ItemGroup>
<ItemGroup>
<Folder Include="Database\Dapper\" />
</ItemGroup>
</Project>