简体   繁体   中英

What would be best approach to do multiple functional checking on List of Files?

I have list of files ,where each file should undergo some group functional validations (10 methods) and return the status (Success/Failure)of the each validation. Mean while I need to notify the client the status of each file. This application is a web application. I think for the above scenario we can loop the list of files and process each functional validation throw the status to client. If the list of files are increased more then this process could slow down the performance. Can we do using TPL ? Can any one suggest me with best solution ? Any helpful link if possble.

One way to do it would be to use ConcurrentQueue and one or more dedicated threads to share the work. Another way would be to use Tasks, for which you would probably do a fairly similar thing, create a ConcurrentQueue of Tasks and give each Task a ContinueWith that will fetch another task from the queue and start it. If the producer is slower to produce Tasks than they are completed then at some point there will be no tasks running, anymore, though. Generally for this scenario, I'd consider a thread to be the better choice (although worker threads in asp.net applications can cause trouble with IIS shutting them down randomly).

For sending notifications to the client I'd recommend SignalR .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM