rails / solid_cable

A database backed ActionCable adapter
MIT License
217 stars 14 forks source link

Enable autotrimming #11

Closed npezza93 closed 1 month ago

npezza93 commented 1 month ago

Fixes #10

npezza93 commented 1 month ago

testing this on prod and its working like a charm

dhh commented 1 month ago

Awesome. Wonder if we should gel the domain language around trimming vs pruning?

dhh commented 1 month ago

@djmb Could you have a look?

npezza93 commented 1 month ago

Awesome. Wonder if we should gel the domain language around trimming vs pruning?

I've renamed everything from prune to trim. Is that what you mean?

dhh commented 1 month ago

Ah great. Yes 👍

kevinmcconnell commented 1 month ago

@npezza93 what do you think about triggering the trimming according to send activity, rather than unsubscribes? Could trigger a trim every n messages (by keeping a counter, or just using a random check on each write that's weighted according to that n, which will average out to the same thing).

That way the trimming workload would be balanced with the write workload, rather than being dependent on how often clients unsubscribe. Which I think should better match the work that trimming has to do -- the more messages you send, the more of them you'll have to trim.

djmb commented 1 month ago

I'd recommend a random check rather than a counter - you don't need to store the counter state, and you avoid a thundering herd from a bunch of processes booted together.