[COMPONENT][Notification] Don't explode with understandable duplicate notifications
This is common when a duplicate federation request is received
This commit is contained in:
parent
6f3e760c63
commit
e86dbad6d6
@ -119,11 +119,17 @@ class Notification extends Component
|
|||||||
// XXX: Unideal as in failures the rollback will leave behind a false notification,
|
// XXX: Unideal as in failures the rollback will leave behind a false notification,
|
||||||
// but most notifications (all) require flushing the objects first
|
// but most notifications (all) require flushing the objects first
|
||||||
// Should be okay as long as implementors bear this in mind
|
// Should be okay as long as implementors bear this in mind
|
||||||
DB::wrapInTransaction(fn () => DB::persist(Entity\Notification::create([
|
try {
|
||||||
'activity_id' => $activity->getId(),
|
DB::wrapInTransaction(fn () => DB::persist(Entity\Notification::create([
|
||||||
'target_id' => $target->getId(),
|
'activity_id' => $activity->getId(),
|
||||||
'reason' => $reason,
|
'target_id' => $target->getId(),
|
||||||
])));
|
'reason' => $reason,
|
||||||
|
])));
|
||||||
|
} catch (\Exception|\Throwable $e) {
|
||||||
|
// We do our best not to record duplicated notifications, but it's not insane that can happen
|
||||||
|
Log::error('It was attempted to record an invalid notification!', [$e]);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
FreeNetwork::notify($sender, $activity, $remote_targets, $reason);
|
FreeNetwork::notify($sender, $activity, $remote_targets, $reason);
|
||||||
|
Loading…
Reference in New Issue
Block a user