amberframework / amber

A Crystal web framework that makes building applications fast, simple, and enjoyable. Get started with quick prototyping, less bugs, and blazing fast performance.
https://amberframework.org
MIT License
2.57k stars 205 forks source link

Use Redis Adapter and fix Redis Adapter for Websockets #1262

Closed mixflame closed 3 years ago

mixflame commented 3 years ago

Description of the Change

Alternate Designs

Tried using an array of subscribers... grew too big

Also tried playing with the crystal-redis lib and subscribing without a block like it says it wants to, but that implementation doesn't work

Benefits

Speed improvement and stability for production

If multiple processes could PUBSUB with Redis properly, there is a scalability increase to the platform for sites that use Redis. Currently, that isn't working using Amber's built in feature for using multiple processes in production but it should.

Possible Drawbacks

MemoryAdapter is no longer used. This makes Redis a requirement to load an Amber server. Instead, Amber should check for a build flag and choose an adapter accordingly.