Skip to content

[FIX] Unsubscribe rooms listeners immediately on server change#1153

Merged
diegolmello merged 1 commit intodevelopfrom
fix.stop-rooms-subscriptions
Aug 27, 2019
Merged

[FIX] Unsubscribe rooms listeners immediately on server change#1153
diegolmello merged 1 commit intodevelopfrom
fix.stop-rooms-subscriptions

Conversation

@diegolmello
Copy link
Copy Markdown
Member

@diegolmello diegolmello commented Aug 27, 2019

@RocketChat/ReactNative

On #987, I fixed a few race conditions, but I left listeners created by RocketChat.subscribeRooms to be closed on the next roomsRequest action.
Although it works in most cases, if the user changes from one server to another, it keeps connect and disconnect listeners opened and it runs roomsRequest before setting next server.

This PR fixes it by moving this.roomsSub back to RocketChat.

Test plan

  • Login must request and subscribe to rooms changes
  • Changing server must request and subscribe to rooms changes
  • With two servers logged in: Logging out from one server must request and subscribe to rooms changes for the other
  • Notifications must request and subscribe to rooms changes
  • Adding a new server must request and subscribe to rooms changes

Note:

  • Request is a /GET Rest API for subscriptions.get and rooms.get
  • Subscribe is listening for changes via socket

Copy link
Copy Markdown
Contributor

@djorkaeffalexandre djorkaeffalexandre left a comment

Choose a reason for hiding this comment

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

LGTM

@diegolmello diegolmello merged commit 0aeedbb into develop Aug 27, 2019
@diegolmello diegolmello deleted the fix.stop-rooms-subscriptions branch August 27, 2019 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants