Reputation: 1907
My problem is that while an ajax request is going on, the user might click 'contact us' or some other link, but the session is locked, from the ajax, and the user has to wait for that, before being served the next link.
main url:
makes ajax call,
displays data
ajax target:
looks at $_SESSION for various reasons,
calls an api (this will take 5 seconds),
makes changes to $_SESSION,
returns some values
During that 5 seconds, user clicks 'contact us'
onclick: ajax is aborted, by jquery.
I dont care, anymore, what the ajax target did.
Any changes to SESSION dont matter much, either way.
user has to wait the 5 seconds, then the contact page loads.
Where is the proper place to use session_write_close()? Is it even possible, in this situation? (given that I have to write to SESSION, under normal circumstances)
Upvotes: 0
Views: 1895
Reputation: 96159
session_start()
looks at $_SESSION for various reasons
- make copy of values if necessary
session_write_close()
calls an api (this will take 5 seconds),
session_start()
- some kind of optimistic lock checks if necessary
makes changes to $_SESSION,
returns some values
Upvotes: 3