Not signed in (Sign In)
Welcome Guest!
Want to take part in these discussions? If you have an account, sign in now.
If you don't have an account, apply for one now.
    • CommentAuthortom
    • CommentTimeFeb 28th 2008
     
    Hi,

    In my application, I got the problem that some actions that need to do work in the background and just take several seconds to complete. Now if the user clicks on some link while that work is still unfinished (new action hasn't finished rendering yet), the new link is opened, and in some cases, the background work is then interrupted, which is of course not what I want.

    So I need a way to have the background work really run in the background.

    Is it safe to just pcntl_fork in the middle of any controller action?

    Or is there a way to tell Akelos not to use the busy ActionController instance to serve new requests?

    Regards

    Tom
    •  
      CommentAuthorbermi
    • CommentTimeFeb 29th 2008
     

    I wouldn't use pcntl_fork on Apache as you can eat up RAM easily.

    Action Controller does not have a way to run tasks in the background, but you can try running

    shell_exec("nohup ./script/my_long_lasting_script > /dev/null 2> /dev/null & echo $!");
    

    which might work better.

Add your comments
    Username Password
  • Format comments as