aegif / CmisSync

Synchronize content between a CMIS repository and your desktop. Like Dropbox for Enterprise Content Management!
http://CmisSync.com
163 stars 123 forks source link

Limit the number of repo syncing at the same time #499

Open ymolinet opened 9 years ago

ymolinet commented 9 years ago

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.

nicolas-raoul commented 9 years ago

Good idea!

ymolinet commented 9 years ago

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

ymolinet commented 9 years ago

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.

nicolas-raoul commented 9 years ago

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.

ymolinet commented 9 years ago

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.