From 9bcd0ade03594703436e0ca845439bbd17e8e878 Mon Sep 17 00:00:00 2001
From: Nicholas Molnar <65710+neekolas@users.noreply.github.com>
Date: Mon, 27 May 2024 23:20:42 -0700
Subject: [PATCH] Check return value of lock

---
 pkg/mls/store/store.go | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/pkg/mls/store/store.go b/pkg/mls/store/store.go
index e475b914..da2cce5d 100644
--- a/pkg/mls/store/store.go
+++ b/pkg/mls/store/store.go
@@ -111,7 +111,10 @@ func (s *Store) PublishIdentityUpdate(ctx context.Context, req *identity.Publish
 		inboxId := newUpdate.GetInboxId()
 		// We use a pg_advisory_lock to lock the inbox_id instead of SELECT FOR UPDATE
 		// This allows the lock to be enforced even when there are no existing `inbox_log`s
-		txQueries.LockInboxLog(ctx, inboxId)
+		if err := txQueries.LockInboxLog(ctx, inboxId); err != nil {
+			return err
+		}
+
 		log := s.log.With(zap.String("inbox_id", inboxId))
 		inboxLogEntries, err := txQueries.GetAllInboxLogs(ctx, inboxId)
 		if err != nil {