Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

Long Polling - how to session_write_close()

I tried to write a simple long polling script today.
I have a problem where the server gets blocked while the polling is going on. I found this:

http://www.xphp.info/long-polling-php-sessions/

telling me to have the session not lock the server.

 session_write_close();

Closing the session did not really help. Does Phalcon ignore this command, does phalcon lock any other stuff on the server?

I'm on an xampp(32bit) windows 7 x64.



83.2k

Phalcon does not lock any stuff on the server. Sessions are managed and closed by PHP not by the framework.



5.8k
Accepted
answer
edited Mar '14

To help others: Phalcon is of course not the problem. I had to close the database connection before the sleep/usleep like this:

...
$this->di->getShared('db')->close() // i have not tried $this->db->close() which might work as well??
usleep(5000000);
$this->di->getShared('db')->connect() // if needed
...