In that case, I'm really puzzled. Will look into it further. Thank you.

On Wednesday, August 6, 2014 2:42:37 PM UTC-5, Anthony wrote:
>
> If you are storing sessions in files and not doing 
> session.forget(response) anywhere in your code, then there should not be 
> any race conditions, as the session files are locked in that case, which 
> serializes all requests (including ajax requests).
>
> Anthony
>
> On Wednesday, August 6, 2014 9:30:30 PM UTC+2, Spokes wrote:
>>
>> I've been looking into it, and it appears that there is a race condition 
>> situation going on, in which it takes a little while for the session value 
>> to be updated, and some other functionality is accessing that value before 
>> the update is performed. I caught it by accident while debugging using 
>> javascript's alert() function (as a side effect, the alert was delaying 
>> things long enough for the session value to get updated, thus making the 
>> program behave as expected).
>>
>> Can you make any recommendations regarding addressing race conditions 
>> involving updating session with an ajax call?
>>
>> On Wednesday, August 6, 2014 12:48:48 PM UTC-5, Anthony wrote:
>>>
>>> The session is handled the same with ajax requests as with any other 
>>> requests. Hard to say what's going on in this case without seeing any code. 
>>> Presumably the DOM element you are checking for the session value is not 
>>> something that is being updated by your Ajax call.
>>>
>>> Anthony
>>>
>>> On Wednesday, August 6, 2014 6:14:27 PM UTC+2, Spokes wrote:
>>>>
>>>> I've got a page in which ajax is used to update the main content (a 
>>>> bunch of articles), and a variable stored in session is used as an index 
>>>> (let's say there are X articles per page, and the first article shown 
>>>> corresponds to the current index). Regardless of how far the user has 
>>>> scrolled, the value of this session/index variable is shown in 
>>>> *response.toolbar()* as "0" unless the page is refreshed, or unless a 
>>>> link is clicked. 
>>>>
>>>> I'm not quite sure how the session variable is being handled. It seems 
>>>> to get updated - otherwise, the scrolling functionality would not do 
>>>> anything. On the other hand, if I try to access this session variable 
>>>> using 
>>>> something other than the ajax calls which update the target div, the value 
>>>> of the session appears to be 0.
>>>>
>>>> Can someone give me a quick rundown of how session is being handled 
>>>> when used with ajax, and let me know if there's a way to update it without 
>>>> refreshing the page? Thank you.
>>>>
>>>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to