Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Replaces #28 in a safer/cleaner way, following advices from clue/reactphp-redis#142 (comment)
What it does:
ping_interval
is positive, immediately ping connection before$transport->subscribe()
is invoked. Reduces the risk of starting the hub with a broken redis linkunsubscribe
event and trigger a hub crash so that its supervisor can handle its respawn. I initially thought thatunsubscribe
wouldn't be safe (like a subscriber just closing the connection) but it looks it would only be triggered in the case of a lost connection, since Freddie never calls$client->unsubscribe()
.cc @misaert:
With both
ping_interval
enabled and that small addition, the EventSource was always able to recover its connection to the hub once Redis was back on again (during my tests). Can you please give this one a try?Thanks @SimonFrings for the tip!