Spawn an asynchronous thread complete with the current page vars.
You want to return the page quickly to the user, while allowing Lasso to continue processing in a separate thread.
Below is a generic template that you would add the the page you want to split into one or more threads. It will copy all vars currently defined on the page to the async thread.
<?LassoScript
// stuff on your page not async here...
// -------------- BEGIN OF ASYNC CODE --------------
{
// -------------- BEGIN OF ASYNC CODE --------------
// --------------------
// process async!
// --------------------
//
// NOTE: Code below this point is processed in it's own thread!
//
Lasso_ExecutionTimeLimit(60 * 60); // in seconds, set this to something reasonable, currently set to 1 hour
Thread_SetPriority(Thread_GetCurrentID, Thread_Priority_Low); // set priority to low, give more priority to normal web requests (can also make it high if needed)
// recreate vars - don't change the code below - this makes all the vars on the page available to the async thread
iterate: params->(find:'-vars')->(get:1)->value, local:'var';
(var: #var->name) = #var->value;
/iterate;
// do stuff here that you want in it's own thread...
// -------------- END OF ASYNC CODE --------------
}->(asasync: -params=(array: '-vars' = vars));
// -------------- END OF ASYNC CODE --------------
// do more stuff on the current page...
?>
So for example, if you had this before:
include('myfile.inc')
You'd have to change it to this within the async thread:
process(file_read('///path/from/disk/root/myfile.inc'));
Be sure that the async thread has the proper file permissions.
Author: Bil Corry
Created: 30 Dec 2008
Last Modified: 16 Mar 2011
Please note that periodically LassoSoft will go through the notes and may incorporate information from them into the documentation. Any submission here gives LassoSoft a non-exclusive license and will be made available in various formats to the Lasso community.
©LassoSoft Inc 2015 | Web Development by Treefrog Inc | Privacy | Legal terms and Shipping | Contact LassoSoft