@@ -7,7 +7,7 @@ namespace YDotNet.Server.MongoDB;
77
88public sealed class MongoDocumentStorage : IDocumentStorage , IHostedService
99{
10- private readonly UpdateOptions Upsert = new ( ) { IsUpsert = true } ;
10+ private readonly UpdateOptions upsert = new ( ) { IsUpsert = true } ;
1111 private readonly MongoDocumentStorageOptions options ;
1212 private readonly IMongoClient mongoClient ;
1313 private IMongoCollection < DocumentEntity > ? collection ;
@@ -34,7 +34,7 @@ await collection.Indexes.CreateOneAsync(
3434 {
3535 ExpireAfter = TimeSpan . Zero
3636 } ) ,
37- cancellationToken : cancellationToken ) ;
37+ cancellationToken : cancellationToken ) . ConfigureAwait ( false ) ;
3838 }
3939
4040 public Task StopAsync (
@@ -43,33 +43,32 @@ public Task StopAsync(
4343 return Task . CompletedTask ;
4444 }
4545
46- public async ValueTask < byte [ ] ? > GetDocAsync ( string name ,
47- CancellationToken ct = default )
46+ public async ValueTask < byte [ ] ? > GetDocAsync ( string name , CancellationToken ct = default )
4847 {
4948 if ( collection == null )
5049 {
5150 return null ;
5251 }
5352
54- var document = await collection . Find ( x => x . Id == name ) . FirstOrDefaultAsync ( ct ) ;
53+ var document = await collection . Find ( x => x . Id == name ) . FirstOrDefaultAsync ( ct ) . ConfigureAwait ( false ) ;
5554
5655 return document ? . Data ;
5756 }
5857
59- public async ValueTask StoreDocAsync ( string name , byte [ ] doc ,
60- CancellationToken ct = default )
58+ public async ValueTask StoreDocAsync ( string name , byte [ ] doc , CancellationToken ct = default )
6159 {
6260 if ( collection == null )
6361 {
6462 return ;
6563 }
6664
67- await collection . UpdateOneAsync ( x => x . Id == name ,
65+ await collection . UpdateOneAsync (
66+ x => x . Id == name ,
6867 Builders < DocumentEntity > . Update
6968 . Set ( x => x . Data , doc )
7069 . Set ( x => x . Expiration , GetExpiration ( name ) ) ,
71- Upsert ,
72- ct ) ;
70+ upsert ,
71+ ct ) . ConfigureAwait ( false ) ;
7372 }
7473
7574 private DateTime ? GetExpiration ( string name )
0 commit comments