cirospaciari / socketify.py

Bringing Http/Https and WebSockets High Performance servers for PyPy3 and Python3
https://www.socketify.dev
MIT License
1.44k stars 56 forks source link

socketify.py - Fix Cork with Python #15

Closed cirospaciari closed 2 years ago

cirospaciari commented 2 years ago

Cork is not working well in Python and ruby has same issue, more than 1 socket wants to cork at the same time.

First approach use the library like JS/C++:

res.cork(lambda res: res.end("Hello World"))

Second approach, use end and call cork + end inside C++ instead of calling in python:

res.end("Hello World")

Neither of this worked. Need more study and analysis

cirospaciari commented 2 years ago

Next o will try to create an tryCork in C++ and if return false I reschedule/defer the call

cirospaciari commented 2 years ago

Added set_timeout to cork using uv loop next tick