I do not know what may be causing it, except that:
- one ajax/json call is better than many
- each call will lock the session for the use which means they are not
executed concurrently, they are queued, unless you
session._unlock(response).
On Monday, 4 June 2012 11:02:23 UTC-5, Jan Rozhon wrote:
>
> Hi Massimo,
>
> thank you for your answer. Unfortunately, it didnt help. One thing I
> didn't mention and might be causing this trouble is, that I ask for several
> json values provided by similar controllers as I posted in my first post.
> Can the multitude ofjson requests cause this weird behaviour? In other
> words, is it better to provide several small json streams or one large?
>
> Thanks in advance, Jan
>
> Dne pondělí, 4. června 2012 17:38:41 UTC+2 Massimo Di Pierro napsal(a):
>>
>> Try replace output=rows with output=rows.as_list()
>> Perhaps the rows are not json serializable.
>>
>> On Monday, 4 June 2012 02:20:39 UTC-5, Jan Rozhon wrote:
>>>
>>> Hi group, I have encountered a problem when I try to call a controller
>>> which should return a JSON array of values from database. However in abou 1
>>> of 5 cases this call stucks in "loading" phase (chrome animation in tab)
>>> and no response is received. Data is in database, every other controller is
>>> working fine, cpu utilization is pretty low so is the memory and there are
>>> only about 10000 rows in DB. Could you please give me some hints?
>>>
>>> Thanks, Jan
>>>
>>> PS. The controller looks like this:
>>>
>>> def dberrorsselect():
>>> """Performs sql query to get the errors in the form of list of dicts
>>> such as {field_name:value}. This is then transformed to json dict for
>>> transfer."""
>>> if session.tb_id:
>>>
>>> max_id=tb(tb.errors.test_id==session.tb_id).select(tb.errors.id.max()).first()[tb.errors.id.max()]
>>> if max_id != None:
>>> selector_id=int(max_id)-5
>>> else:
>>> selector_id=0
>>> rows=tb((tb.errors.test_id==session.tb_id)&(tb.errors.id >
>>> selector_id)).select(tb.errors.ts, tb.errors.msg_short, tb.errors.msg_long)
>>> output=rows
>>> else:
>>> output=[]
>>> return dict(output=output)
>>>
>>>
>>>