Yup, I see it's running fine in your demo :) I think it should be a bug somewhere else then, like you wrote.
What I meant with one periodical request is that you have one php script that checks first if an archive is created, if not it starts creating one and return the status. If there is already an archive in the making (the 2nd and following requests) it would just return the status. I'm not sure if this would work 100%, didn't think out the php backend stuff for this, and if 2 requests work, it's fine too, not? On Nov 8, 1:37 pm, Phenix <[email protected]> wrote: > Here you can find a demo page of what i want to do > :http://www.mynox.fr/multiple-requests/and ... it works fine :D It > must be something in my script which blocks something. > I will try to find what and i will come back here to post... > > On Nov 8, 1:19 pm, Phenix <[email protected]> wrote: > > > > > It's an idea but the first script creates and add files to the archive > > and takes a lot of time. If i follow your idea, i would need some kind > > of background script which would always turn and check if there is an > > archive to make and which wouldn't be call by the user. > > I'm going to make a demo page to better explain my situation. > > > On Nov 8, 11:58 am, Rolf -nl <[email protected]> wrote: > > > > I'm sorry, didn't test the actual code, but why not create just one > > > periodical request? The first time it would check of there's no zip > > > file created yet, so it starts packing & returns that info > > > (Archiving... start) then the second time it sees there's already a > > > zip file in the making and would return the progress (Archiving... > > > 24%), and finally the archive is created and you can return a download > > > link and stop the timer or whatever you want. > > > > No? > > > > On Nov 6, 11:58 am, Phenix <[email protected]> wrote: > > > > > I've tried to use setInterval instead of timed requests, even to > > > > launch the second request at first, but no changes. > > > > Any idea about maybe an apache configuration or browser limitation? > > > > > On 6 nov, 09:39, Phenix <[email protected]> wrote: > > > > > > Thanks for your answer. > > > > > If i keep it simple, all i need would be only the first script which > > > > > create the archive and when finished returns the "finished, download > > > > > now". The second script is here only to gather some info about the > > > > > process. > > > > > I'm going to make some other tests and will post here if i have > > > > > something new... > > > > > > On 5 nov, 23:09, Jon Hancock <[email protected]> wrote: > > > > > > > I don't know how to make multiple requests work. I do know that I > > > > > > would change your design. If the return of your second post, > > > > > > 'website/etatdlall.php', contains info on if its complete, you can > > > > > > kick off the "finished, download now" function from here and keep > > > > > > things serial. Keep it simple is the best approach. > > > > > > > Jon > > > > > > > On Nov 5, 2:53 pm, Phenix <[email protected]> wrote: > > > > > > > > Hello, > > > > > > > > I'm using version 1.2.4 of Mootools on a php script which creates > > > > > > > a > > > > > > > zip archive of several files. The process can takes time so i > > > > > > > want to > > > > > > > check every 5 seconds what is doing the archiver. > > > > > > > > First of all, i launch a first request which calls the zip > > > > > > > archiver > > > > > > > and start adding all the files : > > > > > > > > *** > > > > > > > var mainReq =new Request({url: 'website/dlall.php?token='+token, > > > > > > > method: 'post', > > > > > > > onComplete:function(data){ > > > > > > > ok = true; > > > > > > > timedReq.stopTimer(); > > > > > > > $('etat-dlall').innerHTML = "4/4 Files > > > > > > > added, you can download it"; > > > > > > > } > > > > > > > }).send(data); > > > > > > > *** > > > > > > > > This request can takes time so i launch timed requests to get > > > > > > > each 5 > > > > > > > seconds the state of the archive (which is updated by the first > > > > > > > script > > > > > > > (dlall.php)) : > > > > > > > > *** > > > > > > > var timedReq = new Request({ > > > > > > > method: 'post', > > > > > > > url: 'website/etatdlall.php', > > > > > > > initialDelay: 5000, > > > > > > > delay: 5000, > > > > > > > limit: 15000, > > > > > > > onComplete:testdlall > > > > > > > }).startTimer({ > > > > > > > token: token > > > > > > > }); > > > > > > > > function testdlall(txt) { > > > > > > > if(!ok) { > > > > > > > var data = JSON.decode(txt); > > > > > > > if(data.etat == "1" || data.etat == "2" || data.etat > > > > > > > == > > > > > > > "3") { > > > > > > > $('etat-dlall').innerHTML = data.etat + "/4 : " + > > > > > > > data.texte + " loading..."; > > > > > > > } > > > > > > > else if(data.etat == "4") { > > > > > > > $('etat-dlall').innerHTML =data.etat + "/4 : " > > > > > > > +data.texte; > > > > > > > timedReq.stopTimer(); > > > > > > > } > > > > > > > else { > > > > > > > $('etat-dlall').innerHTML = txt; > > > > > > > timedReq.stopTimer(); > > > > > > > } > > > > > > > } > > > > > > > } > > > > > > > *** > > > > > > > > I thought that it was possible to manage multiple requests in the > > > > > > > same > > > > > > > time but it doesn't work in this case. The first request is fired, > > > > > > > then the second, but the second waits the first to finish to > > > > > > > return > > > > > > > data... So i can't have an updated state of the archive. > > > > > > > > Do you have any idea why the second script can't work in parallel > > > > > > > with > > > > > > > the first? > > > > > > > > Thanks a lot!
