firehoseio / firehose

Build realtime Ruby web applications. Created by the fine folks at Poll Everywhere.
http://firehose.io/
MIT License
726 stars 72 forks source link

Permit keys to perist forever #68

Closed andrewhampton closed 5 years ago

andrewhampton commented 7 years ago

@bakkdoor what do you think about a change like this to allow keys to persist indefinitely?

bakkdoor commented 7 years ago

I've implemented it in the last commit to master (9acdc9ba32d251d667ff6c8de451415e95ee1ab7) with an explicit persist publish option. The ruby client accepts a persist: true to persist the channel and sequence in redis. Only when this is passed it will persist it. If another message on the same channel comes in without persist: true it will set the expiry again, based on a given TTL or the default TTL. If you always want to persist a channel's messages, make sure to always pass persist: true along.

thoughtless commented 7 years ago

If publishing a message without persist: true adds back the TTL, then my concerns around the redis database growing forever are satisfied. It is simply up to the publisher to "delete" the channels it is done with by publishing an empty message that does not include persist: true.

That said, I do feel that a TTL of 0 is more conventional than persist: true: https://github.com/firehoseio/firehose/commit/9acdc9ba32d251d667ff6c8de451415e95ee1ab7#commitcomment-20285654

bradgessler commented 5 years ago

Firehose wasn’t designed to be a persistent data store. Persistent data should live on the application server and be served up via HTTP.

For data that should live a long time, a large ttl could be passed into the publish payload to satisfy this use case.