fanout / django-eventstream

Server-Sent Events for Django
MIT License
638 stars 84 forks source link

Use Redis as storage #145

Closed erfantarighi closed 2 months ago

erfantarighi commented 2 months ago

I added a RedisStorage class which is faster and more efficient, I strongly recommend using RedisStorage as the default storage. because in high traffic using the Django default database can harm or make the backend slow (MySQL has a connection limit)

jkarneges commented 2 months ago

Conceptually looks good.

Comments:

erfantarighi commented 2 months ago

Thanks for the comments @jkarneges

jkarneges commented 2 months ago

Well, there are transactions of sorts using multi/exec. I forgot that the python lib does this by default when pipeline mode is used.

I'll merge this but I strongly suggest pipelining the reads too. Otherwise, a single call to get_events() may do many round trips (e.g. fetching 100 items is 100 round trips).

williamrexhardin commented 1 month ago

This change is particularly interesting. Will there be a release available soon with these changes? 5.1.1?

jkarneges commented 1 week ago

Released 5.2.0 with this change.