refactor(backend): replace coravel with hangfire for background jobs

for *some reason*, coravel locks a persistent job queue behind a
paywall. this means that if the server ever crashes, all pending jobs
are lost. this is... not good, so we're switching to hangfire for that
instead.

coravel is still used for emails, though.

BREAKING CHANGE: Foxnouns.NET now requires Redis to work. the EFCore
storage for hangfire doesn't work well enough, unfortunately.
This commit is contained in:
sam 2025-03-04 17:03:39 +01:00
parent cd24196cd1
commit 7759225428
Signed by: sam
GPG key ID: B4EF20DDE721CAA1
24 changed files with 272 additions and 269 deletions

View file

@ -27,7 +27,6 @@ public class ModerationService(
ILogger logger,
DatabaseContext db,
ISnowflakeGenerator snowflakeGenerator,
IQueue queue,
IClock clock
)
{
@ -181,9 +180,7 @@ public class ModerationService(
target.CustomPreferences = [];
target.ProfileFlags = [];
queue.QueueInvocableWithPayload<UserAvatarUpdateInvocable, AvatarUpdatePayload>(
new AvatarUpdatePayload(target.Id, null)
);
UserAvatarUpdateJob.Enqueue(new AvatarUpdatePayload(target.Id, null));
// TODO: also clear member profiles?
@ -264,10 +261,9 @@ public class ModerationService(
targetMember.DisplayName = null;
break;
case FieldsToClear.Avatar:
queue.QueueInvocableWithPayload<
MemberAvatarUpdateInvocable,
AvatarUpdatePayload
>(new AvatarUpdatePayload(targetMember.Id, null));
MemberAvatarUpdateJob.Enqueue(
new AvatarUpdatePayload(targetMember.Id, null)
);
break;
case FieldsToClear.Bio:
targetMember.Bio = null;
@ -306,10 +302,7 @@ public class ModerationService(
targetUser.DisplayName = null;
break;
case FieldsToClear.Avatar:
queue.QueueInvocableWithPayload<
UserAvatarUpdateInvocable,
AvatarUpdatePayload
>(new AvatarUpdatePayload(targetUser.Id, null));
UserAvatarUpdateJob.Enqueue(new AvatarUpdatePayload(targetUser.Id, null));
break;
case FieldsToClear.Bio:
targetUser.Bio = null;