There are two possible causes for locking. session locking. You can unlock them with session._unlock(response)
sqlite locking. Nothing you can do other than not using sqlite. On May 24, 8:16 am, Candid <roman.bat...@gmail.com> wrote: > I might be completely wrong, but I think the problem is that web2py > locks the session file while executing controller's actions, so two > simultaneous requests within the same session are processed one by one > sequentially. > > On May 24, 8:37 am, eddie <eddie.sh...@gmail.com> wrote: > > > I have found this recent thread: > > >http://groups.google.com/group/web2py/browse_thread/thread/80941011f6... > > > But I'm still not entirely sure what the net result is for multiple > > controller calls, via ajax or otherwise. > > > What exactly does the -n option allow in terms of threading and > > handling requests in parallel? > > > On May 24, 8:47 pm, eddie <eddie.sh...@gmail.com> wrote: > > > > Hi guys, > > > > I'm looking for some help on allowing controller functions to respond > > > to ajax calls from a view in parallel. I've got my head around the > > > basic web2py architecture, but this is my first time trying out ajax > > > in web2py. > > > > Here's the problem. I have a simple view that makes a number of ajax > > > calls, to provide delay loading of data. The results are from querying > > > and parsing URLs on demand, so they can be slow. The controller > > > function I am calling (default/results_data) appears to be blocking, > > > only executing one request at a time. This obviously defeats the > > > purpose of delay loading the data on the page. > > > > I have made sure I am running the web2py app locally with the -n > > > option (for threads), but this isn't the issue. I have found the > > > session.forget() call, but this isn't it either. > > > > I am guessing there is something fundamental that I am doing wrong > > > here, I am hoping someone can clarify what is required to allow the > > > controller functions that respond to the ajax query to execute in > > > parallel, without blocking. > > > > A snippet from the html generated by the view: > > > > function sendRequest(url,callback,postData) { > > > try { > > > var req = createXMLHTTPObject(); > > > if (!req) return; > > > var method = (postData) ? "POST" : "GET"; > > > req.open(method,url,true); > > > req.setRequestHeader('User-Agent','XMLHTTP/1.0'); > > > if (postData) > > > > > > req.setRequestHeader('Content-Type','application/x-www-form- > > > urlencoded'); > > > req.onreadystatechange = function () { > > > if (req.readyState != 4) return; > > > if (req.status != 200 && req.status != 304) { > > > alert('HTTP error ' + req.status); > > > return; > > > } > > > callback(req); > > > } > > > > if (req.readState == 4) return; > > > req.send(postData); > > > } > > > catch (e) { > > > throw e;//alert(e); > > > }} > > > > ... > > > <script> > > > function source1_results(req) > > > {document.getElementById('query1_results').innerHTML = > > > req.responseText;} > > > sendRequest('/myapp/default/results_data? > > > query=foo&source_name=source1', source1_results) > > > function souce2_results(req) > > > {document.getElementById('source2_results').innerHTML = > > > req.responseText;} > > > sendRequest('/myapp/default/results_data? > > > query=foo&source_name=source2', source2_results) > > > </script> > > > ... > > > <table> > > > <tr><td>source1</td><td id="source1_results">Loading...</td><td><a > > > href="http://...">View page</a></td></tr> > > > <tr><td>source2</td><td id="source2_results">Loading...</td><td><a > > > href="http://...">View page</a></td></tr> > > > </table>