From 69a72ced4c69aaf0d0a8a8e6fd24b25ebf970941 Mon Sep 17 00:00:00 2001 From: SzymonPobiega Date: Tue, 26 Sep 2017 09:47:16 +0200 Subject: [PATCH] Use update lock hint when loading timeouts --- .../TimeoutPersisters/TimeoutPersister.cs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/NServiceBus.NHibernate/TimeoutPersisters/TimeoutPersister.cs b/src/NServiceBus.NHibernate/TimeoutPersisters/TimeoutPersister.cs index cbf8a02f6..b89ae3589 100644 --- a/src/NServiceBus.NHibernate/TimeoutPersisters/TimeoutPersister.cs +++ b/src/NServiceBus.NHibernate/TimeoutPersisters/TimeoutPersister.cs @@ -154,10 +154,7 @@ public async Task Peek(string timeoutId, ContextBag context) using (var session = await OpenSession(context).ConfigureAwait(false)) { var id = Guid.Parse(timeoutId); - var te = session.Session().QueryOver() - .Where(x => x.Id == id) - .List() - .SingleOrDefault(); + var te = session.Session().Get(id, LockMode.Upgrade); var timeout = MapToTimeoutData(te); return timeout;