madelson / DistributedLock

A .NET library for distributed synchronization
MIT License
1.86k stars 192 forks source link

code optimization #167

Closed jokoyoski closed 1 year ago

jokoyoski commented 1 year ago

In the optimized version, the ValueTask type is used to store the result of the asynchronous operation. By using the AsTask method on the ValueTask, you convert it to a Task when the synchronous path is taken. Then, you can await the Task in both cases, ensuring a consistent usage pattern.

Additionally, I removed the unnecessary this keyword before _blobClient assuming it's not required for the current context. Remember to adjust the code accordingly if necessary.