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

Clear related pending requests on session disconnect #1354

Closed
wants to merge 1 commit into from

Conversation

jackpooleywc
Copy link
Contributor

Description

This is a follow up to #1353.

In addition to clearing stale requests on initialisation, this PR also makes sure requests related to the session that is being disconnected are also cleared.

Resolves #1343

How Has This Been Tested?

Note

This has not yet been tested against the bug as I am still unable to reproduce, this will be tested before merging.

Due Dilligence

  • Breaking change
  • Requires a documentation update

Copy link

Quality Gate Passed Quality Gate passed

Issues
9 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

}

func disconnect(topic: String) async throws {
invalidRequestsSanitiser.removeSessionRequestsWith(topic: topic)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

A couple of notes:

  • I'm not sure what the performance impact of this call is, if it blocks the thread and for how long
  • Not sure if this is thread safe

We should check before merging.

@@ -17,4 +24,27 @@ final class InvalidRequestsSanitiser {
history.deleteAll(forTopics: Array(invalidTopics))
}
}

func removeSessionRequestsWith(topic: String) {
Copy link
Contributor

Choose a reason for hiding this comment

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

just a style comment as it would be more consistent with what we have, can we declare this func like: removeSessionRequests(with topic: String)?

Comment on lines +29 to +32
let pendingRequestTopics = historyService
.getPendingRequests(topic: topic)
.map(\.request)
.map(\.topic)
Copy link
Contributor

Choose a reason for hiding this comment

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

do we need to perform this operation? don't we get a single topic that was provided during a function call as a result?

}

func disconnect(topic: String) async throws {
invalidRequestsSanitiser.removeSessionRequestsWith(topic: topic)

if sessionStorage.hasSession(forTopic: topic) {
try await deleteSessionService.delete(topic: topic)
Copy link
Contributor

Choose a reason for hiding this comment

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

should we maybe call invalidRequestsSanitiser.removeSessionRequestsWith(topic: topic) here?

Copy link
Contributor

Choose a reason for hiding this comment

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

but I think we could also just call rpchistory.deleteAll(forTopic: topic)

@jackpooleywc jackpooleywc deleted the jack/clear-requests-on-disconnect branch May 16, 2024 10: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.

Unactionable request appearing on sessionRequestPublisher when upgrading from 1.10.0 -> 1.18.4
2 participants