Skip to content

Drop messages where channel does not exist - #914

Merged
AndyTWF merged 2 commits into
mainfrom
913-released-channels-re-creating
Feb 7, 2023
Merged

AndyTWF merged 2 commits into
mainfrom
913-released-channels-re-creating

Conversation

@AndyTWF

@AndyTWF AndyTWF commented Feb 6, 2023

Copy link
Copy Markdown
Contributor

At the moment, if a message is received and a channel does not exist the channel is created (via channels.get) to process the message.

This can lead to issues with channels.release, which also detaches the channel after removing it from the channel map. If the timing is unfortunate, then the DETACH message will come back and re-create the channel, meaning it cannot be recreated afresh later.

This change fixes the issues by dropping any messages that are received for a non existent channel and logs the fact that this has happened.

Fixes #913

At the moment, if a message is received and a channel does not exist
the channel is created (via channels.get) to process the message.

This can lead to issues with channels.release, which also detaches the channel
after removing it from the channel map. If the timing is unfortunate,
then the DETACH message will come back and re-create the channel, meaning
it cannot be recreated afresh later.

This change fixes the issues by dropping any messages that are received for
a non existent channel and logs the fact that this has happened.

Fixes #913
@github-actions
github-actions Bot temporarily deployed to staging/pull/914/javadoc February 6, 2023 11:15 Inactive
@AndyTWF
AndyTWF marked this pull request as ready for review February 6, 2023 13:49
@AndyTWF
AndyTWF requested review from QuintinWillison, ikbalkaya and paddybyers and removed request for QuintinWillison February 6, 2023 13:53

@ikbalkaya ikbalkaya left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code looks good overall. I have made some requests that will hopefully improve the code.

Comment thread lib/src/main/java/io/ably/lib/realtime/AblyRealtime.java
Comment thread lib/src/test/java/io/ably/lib/test/realtime/RealtimeChannelTest.java Outdated

@paddybyers paddybyers left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thanks

Comment thread lib/src/main/java/io/ably/lib/realtime/AblyRealtime.java
@AndyTWF
AndyTWF merged commit bd35085 into main Feb 7, 2023
@AndyTWF
AndyTWF deleted the 913-released-channels-re-creating branch February 7, 2023 09:20

This branch was successfully deployed

1 active deployment
staging/pull/914/javadoc — 42d89759 Deployed Feb 6, 2023 by github-actions[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Released channel re-added to the channel map after DETACHED message

3 participants