
omega at palle
Oct 26, 2006, 2:57 PM
Post #21 of 24
(786 views)
Permalink
|
|
Re: Re: How to redirect before some code excute
[In reply to]
|
|
I had to do something similar for a client recently, and although that clients codebase isnt catalyst, I still think my findings might be relative enough. What I ended up doing was writing a (very) small POE server, listening on HTTP for commands. This server then simply returns whenever it gets a request, after queueing the job. They both use the same DB, so whenever the jobserver(poe thingy) is done, it updates a field in the DB with status. On the frontendserver I then refresh the status either with ajax or with page refreshes (if you care how the job went). I think this approach is quite flexible, as it allows me (if needed) to split the proces on two machines, and I dont have to worry about forking etc, since the poe server is single process. Admittedly my jobs are all run on a 3rd server (running windows), so I only have to do a small tcp-call to check the job-status from the poe-server, so if you have really long running jobs, this might not be enough after all, but POE has some cookbook examples of running long running jobs that might help you. If you want to take a look at some of the POE stuff I did, just let me know. andreas On 26. okt. 2006, at 17.11, Jay K wrote: > Hi, > > I think the idea is to start a long-running process based on a web- > based trigger.... and allow the user to proceed on to do other > things. In other systems a fork() would probably be in order. > > I'm curious also - is there a Catalyst specific way of doing > something like that...? and if not, is there any danger in fork()ing > inside a catalyst app? > > Jay > > On Oct 26, 2006, at 9:43 AM, leonard.a.jaffe [at] jpmchase wrote: > >> >> Fayland Lam <fayland [at] gmail> wrote: >> > >> > Lee Standen wrote: >> > > It's a subroutine, right? >> > > >> > > Tried a return?....such as: >> > > >> > > $c->res->redirect('http://www.yahoo.com'); >> > > return undef; >> > >> > Indeed I want to run the 'while' loop in backend. 'return' would >> not run >> > the loop I think. >> >> Why do you want to run the loop in the background? >> What purpose will it serve? >> >> If we can learn your motivation, we can try to find you >> At Least One Way To Do It. >> >> Len. >> >> >> >> >> This transmission may contain information that is privileged, >> confidential, legally privileged, and/or exempt from disclosure >> under applicable law. If you are not the intended recipient, you >> are hereby notified that any disclosure, copying, distribution, or >> use of the information contained herein (including any reliance >> thereon) is STRICTLY PROHIBITED. Although this transmission and >> any attachments are believed to be free of any virus or other >> defect that might affect any computer system into which it is >> received and opened, it is the responsibility of the recipient to >> ensure that it is virus free and no responsibility is accepted by >> JPMorgan Chase & Co., its subsidiaries and affiliates, as >> applicable, for any loss or damage arising in any way from its use. >> If you received this transmission in error, please immediately >> contact the sender and destroy the material in its entirety, >> whether in electronic or hard copy format. Thank you. >> >> _______________________________________________ >> List: Catalyst [at] lists >> Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst >> Searchable archive: http://www.mail-archive.com/ >> catalyst [at] lists/ >> Dev site: http://dev.catalyst.perl.org/ > > --- > "May we not return to those scoundrels of old, the illustrious > founders of superstition and fanaticism, who first took the knife > from the altar to make victims of those who refused to be their > disciples." - Voltaire > > > > _______________________________________________ > List: Catalyst [at] lists > Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst > Searchable archive: http://www.mail-archive.com/ > catalyst [at] lists/ > Dev site: http://dev.catalyst.perl.org/ _______________________________________________ List: Catalyst [at] lists Listinfo: http://lists.rawmode.org/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst [at] lists/ Dev site: http://dev.catalyst.perl.org/
|