Open ymolinet opened 9 years ago
Good idea!
Backgroundworker is the same as ThreadPool http://stackoverflow.com/questions/17008550/thread-threadpool-or-backgroundworker
so, It seems that we can just set ThreadPool.SetMaxThreads http://stackoverflow.com/questions/17427214/how-to-stop-backgroundworker-from-queuing
I'm working on the necessary code, but an issue occur. When Backgroundworker is "paused" by the ThreadPool, the status is set to Suspended but this status is used to identify the repo is suspended by the user ... some more changes are needed.
By the way, we should not write the "Paused" information in the config file, because it might corrupt the file if CmisSync exits at the wrong time. The right place for such dynamic information is the database, in the "general" table.
I'm searching where is the problem, but at this time I don't found any "link" that could change the status of the CmisRepo Object when the BackgroundWorker from SynchronizedFolder object is set to "paused" by the ThreadPool.
I'm just manage the parameters (number of process allow at the same time) in config.xml and add:
ThreadPool.SetMaxThreads(x,y);
More reflexion is needed.
Add a parameters to limit the number of repo syncing at the same time. Even if poll intervall is correctly set, after a long period with no network access, each repo try to sync at the same time. A lot of performance (network, pc and server) are required for this. Limit the number of repo syncing at the same time could reduce this effect but if a repo is "waiting" for syncing, the sync must be launch when a "place" is available is the queue, not waiting the next poll interval.