lighthouse icon indicating copy to clipboard operation
lighthouse copied to clipboard

Add TTL or clear-subscriptions command

Open alberthaff opened this issue 6 years ago • 2 comments

Currently, the subscriptions continue to broadcast events until the channel is deleted with the webhook. One problem with this technique, is that local dev-environments are usually not available to Pusher. An other problem is that any failed webhook-calls in production, will result in a subscription living on indefinitely.

It seems like the Pusher API can deliver information about users in a particular channel. This should allow us to retain any channels that still has an active subscriber. However, the TTL will avoid going through all channels that are most likely still in use, since they are eg. less 1 hr old.

I suggest that we add a new command, php artisan lighthouse:clear-subscriptions -TTL 3600, that will delete any vacant channels that have expired it's TTL (1 hr in this case). This new command can easily be added to the schedular and used manually during development.

alberthaff avatar Aug 26 '19 19:08 alberthaff

This does not exactly fix this issue but might help: #1284.

It allows a TTL for the subscriptions to expire from the cache automatically.

Combining that with #1288 which cleans up any left-over topics this might be an acceptable solution.

stayallive avatar Apr 14 '20 15:04 stayallive

@alberthaff i think the suggestion is reasonable and i see how it can be useful. I will gladly accept a PR.

spawnia avatar Apr 30 '20 21:04 spawnia