Skip to content

Commit

Permalink
fixup! fix(userstatus): catch unique constraint violation
Browse files Browse the repository at this point in the history
  • Loading branch information
miaulalala committed Jan 16, 2024
1 parent d1c861a commit ec04660
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion apps/user_status/lib/Listener/UserLiveStatusListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,11 @@ public function handle(Event $event): void {
$this->mapper->insert($userStatus);
} catch (Exception $e) {
if ($e->getReason() === Exception::REASON_UNIQUE_CONSTRAINT_VIOLATION) {
$this->logger->debug('Unique constraint violation for live user status');
// A different process might have written another status
// update to the DB while we're processing our stuff.
// We can safely ignore it as we're only changing between AWAY and ONLINE
// and not doing anything with the message or icon.
$this->logger->debug('Unique constraint violation for live user status', ['exception' => $e]);
return;
}
throw $e;
Expand Down

0 comments on commit ec04660

Please sign in to comment.