destan
destan

Reputation: 4411

Redis: how (or should) I delete pubsub channels

In my app I dynamically create new pubsub channels and there might be too many like 5k per day. According to my app's requirements any channel is used for at most 5minutes.

Considering this situation, thousands of unused channels will be present in the app in a week. So how can I delete unused channels or should I even delete them. Do they stored in memory? What happens to the messages published via them, do they stay on the redis' memory?

thanks

Upvotes: 15

Views: 15560

Answers (1)

Marc Gravell
Marc Gravell

Reputation: 1062560

Channels are ambient. They only exist while there are subscriptions. So: either call [P]UNSUBSCRIBE from the connections that subscribed, or close the connections that subscribed.

Upvotes: 25

Related Questions