@@ -91,7 +91,7 @@ internal static void Release(IDbConnection connection, string resource, PostgreS
91
91
92
92
if ( ! LockHandler . TryRemoveLock ( resource , connection , options , false ) )
93
93
{
94
- throw new PostgreSqlDistributedLockException ( $ "Could not release a lock on the resource ' { resource } '. Lock does not exist." ) ;
94
+ throw new PostgreSqlDistributedLockException ( resource ) ;
95
95
}
96
96
}
97
97
@@ -102,14 +102,12 @@ public static void Lock(string resource, TimeSpan timeout, IDbConnection connect
102
102
Stopwatch lockAcquiringTime = Stopwatch . StartNew ( ) ;
103
103
104
104
bool tryAcquireLock = true ;
105
- Exception lastException = null ;
106
105
Func < IDbConnection , string , string , bool > tryLock = options . UseNativeDatabaseTransactions
107
106
? TransactionLockHandler . TryLock
108
107
: UpdateCountLockHandler . TryLock ;
109
108
110
109
while ( tryAcquireLock )
111
110
{
112
- lastException = null ;
113
111
if ( connection . State != ConnectionState . Open )
114
112
{
115
113
connection . Open ( ) ;
@@ -126,7 +124,6 @@ public static void Lock(string resource, TimeSpan timeout, IDbConnection connect
126
124
}
127
125
catch ( Exception ex )
128
126
{
129
- lastException = ex ;
130
127
Log ( resource , "Failed to acquire lock" , ex ) ;
131
128
}
132
129
@@ -153,7 +150,7 @@ public static void Lock(string resource, TimeSpan timeout, IDbConnection connect
153
150
}
154
151
}
155
152
156
- throw new PostgreSqlDistributedLockException ( $@ "Could not place a lock on the resource ' { resource } ': Lock timeout." , lastException ) ;
153
+ throw new PostgreSqlDistributedLockException ( resource ) ;
157
154
}
158
155
159
156
public static bool TryRemoveLock ( string resource , IDbConnection connection , PostgreSqlStorageOptions options , bool onlyExpired )
0 commit comments