We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

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:

https://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.



98.9k

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



9.2k
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
...