Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[CIS-1223] Fix API requests being cancelled on first connect #1538

Merged
merged 1 commit into from
Oct 12, 2021

Conversation

evsaev
Copy link
Contributor

@evsaev evsaev commented Oct 11, 2021

🔗 Issue Link

CIS-1223

🎯 Goal

To fix pending API requests being cancelled when chat client is connected for the first time.

🛠 Implementation

Added the check to explicitly handle the first connect.

🧪 Testing

The way to see the fix in action is to have a ChannelVC that connects a client in setUp after calling super.setUp where the channel request is initiated:

final class ChannelVC: ChatChannelVC {
    var token: Token!
    var userId: UserId!

    override func setUp() {
        super.setUp()

        client.connectUser(
            userInfo: .init(id: userId),
            token: token
        )
    }
    
    deinit {
        client.disconnect()
    }
}

☑️ Checklist

  • I have signed the Stream CLA (required)
  • Changelog is updated with client-facing changes
  • New code is covered by unit tests
  • Affected documentation updated (docusaurus, tutorial, CMS (task created)

@evsaev evsaev added 🐞 Bug An issue or PR related to a bug 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK labels Oct 11, 2021
@evsaev evsaev requested a review from a team October 11, 2021 15:31
@evsaev evsaev self-assigned this Oct 11, 2021
@evsaev evsaev force-pushed the CIS-1223-first-connect-cancelling-api-requests branch 3 times, most recently from 6d30982 to 3c78305 Compare October 11, 2021 16:37
@evsaev evsaev force-pushed the CIS-1223-first-connect-cancelling-api-requests branch from 3c78305 to aeb4c72 Compare October 12, 2021 09:31
@codecov
Copy link

codecov bot commented Oct 12, 2021

Codecov Report

Merging #1538 (aeb4c72) into main (390114f) will decrease coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1538      +/-   ##
==========================================
- Coverage   88.32%   88.32%   -0.01%     
==========================================
  Files         231      231              
  Lines       10838    10850      +12     
==========================================
+ Hits         9573     9583      +10     
- Misses       1265     1267       +2     
Flag Coverage Δ
llc-tests 88.32% <100.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
Sources/StreamChat/Workers/ChatClientUpdater.swift 94.33% <100.00%> (+0.72%) ⬆️
...urces/StreamChat/Utils/MainQueue+Synchronous.swift 66.66% <0.00%> (-33.34%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 390114f...aeb4c72. Read the comment docs.

@evsaev evsaev merged commit e88861d into main Oct 12, 2021
@evsaev evsaev deleted the CIS-1223-first-connect-cancelling-api-requests branch October 12, 2021 10:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 Bug An issue or PR related to a bug 🌐 SDK: StreamChat (LLC) Tasks related to the StreamChat LLC SDK
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants