robinrodricks / FluentStorage

A polycloud .NET cloud storage abstraction layer. Provides Blob storage (AWS S3, GCP, FTP, SFTP, Azure Blob/File/Event Hub/Data Lake) and Messaging (AWS SQS, Azure Queue/ServiceBus). Supports .NET 5+ and .NET Standard 2.0+. Pure C#.
MIT License
263 stars 33 forks source link

Recursive list directory for FluentStorage.SFTP #56

Closed beeradmoore closed 7 months ago

beeradmoore commented 7 months ago

Fixes

Issue #55

Description

Not sure the preferred way to handle this. I created a local function so I could share the lock object rather than adding it as a class variable. If you are using .NET 6+ it allows the use of Parallel.ForEachAsync. Because of using Parallel.ForEachAsync I also added a lock for updating the main list. Unsure if there are complications of allowing this to query a server multiple times at once (also with no upper bound set).

I am also unsure if this should be littered with .ConfigureAwait(false) for all those tasks it is using.

I have not run any of the tests to confirm these changes work, but this is copy/pasted where I am using it for an internal tool I am testing out.

robinrodricks commented 7 months ago

Can you extract the async method as a new method, because I don't like the pattern of methods being declared inside other methods.

robinrodricks commented 7 months ago

Thanks a lot!