@@ -95,14 +95,14 @@ public async ValueTask DisposeAsync()
9595 // Dispose the timer first, because it might still access other things until it's been disposed!
9696 if ( _cleanupTimer is not null )
9797 {
98- await _cleanupTimer . DisposeAsync ( ) ;
98+ await _cleanupTimer . DisposeAsync ( ) . ConfigureAwait ( false ) ;
9999 }
100100
101- await Commands . DisposeAsync ( ) ;
101+ await Commands . DisposeAsync ( ) . ConfigureAwait ( false ) ;
102102
103103 _logger . LogTrace ( "Closing connection to SQLite database at {SqliteCacheDbPath}" , _config . CachePath ) ;
104- await _db . CloseAsync ( ) ;
105- await _db . DisposeAsync ( ) ;
104+ await _db . CloseAsync ( ) . ConfigureAwait ( false ) ;
105+ await _db . DisposeAsync ( ) . ConfigureAwait ( false ) ;
106106 }
107107#endif
108108
@@ -227,7 +227,7 @@ private async Task<bool> CheckExistingDbAsync(DbConnection db, CancellationToken
227227 // Check for correct structure
228228 using ( var cmd = new DbCommand ( @"SELECT COUNT(*) from sqlite_master" , db ) )
229229 {
230- var result = ( long ) await cmd . ExecuteScalarAsync ( cancel ) ;
230+ var result = ( long ) await cmd . ExecuteScalarAsync ( cancel ) . ConfigureAwait ( false ) ;
231231 // We are expecting two tables and one additional index
232232 if ( result != 3 )
233233 {
@@ -239,7 +239,7 @@ private async Task<bool> CheckExistingDbAsync(DbConnection db, CancellationToken
239239 // Check for correct version
240240 using ( var cmd = new DbCommand ( "SELECT value FROM meta WHERE key = 'version'" , db ) )
241241 {
242- var result = ( long ) await cmd . ExecuteScalarAsync ( cancel ) ;
242+ var result = ( long ) await cmd . ExecuteScalarAsync ( cancel ) . ConfigureAwait ( false ) ;
243243 if ( result != SchemaVersion )
244244 {
245245 _logger . LogWarning ( "Existing cache db has unsupported schema version {SchemaVersion}" ,
@@ -270,8 +270,8 @@ public async ValueTask ConnectAsync(CancellationToken cancel)
270270 _logger . LogTrace ( "Found existing database at {CachePath}" , _config . CachePath ) ;
271271
272272 var db = new SqliteConnection ( _config . ConnectionString ) ;
273- await db . OpenAsync ( ) ;
274- if ( await CheckExistingDbAsync ( db , cancel ) )
273+ await db . OpenAsync ( ) . ConfigureAwait ( false ) ;
274+ if ( await CheckExistingDbAsync ( db , cancel ) . ConfigureAwait ( false ) )
275275 {
276276 // Everything checks out, we can use this as our cache db
277277 _db = db ;
@@ -289,8 +289,8 @@ public async ValueTask ConnectAsync(CancellationToken cancel)
289289 if ( _db == null )
290290 {
291291 _db = new DbConnection ( _config . ConnectionString ) ;
292- await _db . OpenAsync ( ) ;
293- await InitializeAsync ( cancel ) ;
292+ await _db . OpenAsync ( ) . ConfigureAwait ( false ) ;
293+ await InitializeAsync ( cancel ) . ConfigureAwait ( false ) ;
294294 }
295295
296296 Commands = new DbCommandPool ( _db , _logger ) ;
@@ -307,7 +307,7 @@ private async Task InitializeAsync(CancellationToken cancel)
307307 using ( var cmd = new DbCommand ( Resources . TableInitCommand , _db ) )
308308 {
309309 cmd . Transaction = transaction ;
310- await cmd . ExecuteNonQueryAsync ( cancel ) ;
310+ await cmd . ExecuteNonQueryAsync ( cancel ) . ConfigureAwait ( false ) ;
311311 }
312312 using ( var cmd = new DbCommand (
313313 $ "INSERT INTO meta (key, value) " +
@@ -316,7 +316,7 @@ private async Task InitializeAsync(CancellationToken cancel)
316316 $ "('created', { DateTimeOffset . UtcNow . Ticks } )" , _db ) )
317317 {
318318 cmd . Transaction = transaction ;
319- await cmd . ExecuteNonQueryAsync ( cancel ) ;
319+ await cmd . ExecuteNonQueryAsync ( cancel ) . ConfigureAwait ( false ) ;
320320 }
321321 transaction . Commit ( ) ;
322322 }
@@ -341,7 +341,7 @@ private async Task InitializeAsync(CancellationToken cancel)
341341 cmd . Parameters . AddWithValue ( "@key" , key ) ;
342342 cmd . Parameters . AddWithValue ( "@now" , DateTimeOffset . UtcNow . Ticks ) ;
343343 return cmd . ExecuteScalarAsync ( cancel ) ;
344- } ) ) ! ;
344+ } ) . ConfigureAwait ( false ) ) ! ;
345345 }
346346
347347 public void Refresh ( string key )
@@ -425,7 +425,7 @@ public Task ClearAsync(CancellationToken cancel = default)
425425 return Commands . UseAsync ( async conn =>
426426 {
427427 using var cmd = new DbCommand ( "DELETE FROM cache WHERE 1=1;" , conn ) ;
428- await cmd . ExecuteNonQueryAsync ( cancel ) ;
428+ await cmd . ExecuteNonQueryAsync ( cancel ) . ConfigureAwait ( false ) ;
429429 return true ;
430430 } ) ;
431431 }
@@ -523,7 +523,7 @@ public async Task RemoveExpiredAsync(CancellationToken cancel = default)
523523 {
524524 cmd . Parameters . AddWithValue ( "@now" , DateTimeOffset . UtcNow . Ticks ) ;
525525 return cmd . ExecuteScalarAsync ( cancel ) ;
526- } ) ) ! ;
526+ } ) . ConfigureAwait ( false ) ) ! ;
527527
528528 if ( removed > 0 )
529529 {
0 commit comments