On Wed, 13 Nov 2013, Sebastian Kulesz wrote:
> I had the same problem, you can look at my solution here [0]. Basically, i
> used a pool of HttpClients with the async property set to True.
> 
> The logic goes like this. I have an index files which tracks around 120
> files stored online. Not going to get into how i update each file without
> downloading the rest, but suppose i want to download all files to build a
> local copy. By default, i create an array of 10 HttpClient instances. With
> DEFAULT_CLIENT_COUNT you can set it to be more.
> I then load each URL into a queue and start a timer which runs every 10 ms.
> In each run, the timer checks for a free HttpClient instance, if there is
> one it loads it with the popped  URL and saves the file into a predefined
> folder with the same name as it was stored in the server. It runs until the
> queue count is 0.
> 
> You could use tasks, but i found this to be better as it is easier to keep
> track of the progress.
> 
> 
> 
> [0]
> http://bazaar.launchpad.net/~sebikul/mundus/trunk/view/head:/.src/Index.module
> 

Argh! There is a sweet little Queue class in gb.data. I even wrote
documentation for it! And you keep using Private $aQueue As String[]? :-)

Regards,
Tobi

-- 
"There's an old saying: Don't change anything... ever!" -- Mr. Monk

------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Gambas-user mailing list
Gambas-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to