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

Fixes issue #1783 #1790

Merged
merged 3 commits into from
Mar 28, 2024
Merged

Conversation

osm-alt
Copy link
Contributor

@osm-alt osm-alt commented Mar 23, 2024

In case a connection dies, it now only disconnects from that connection and not all connections (considering that there are multiple connections). When there are no remaining connections, it navigates the to the home screen.

…and not all connections. It goes to the home screen after there are no remaining connections.
@osm-alt osm-alt requested a review from a team as a code owner March 23, 2024 11:51
@osm-alt osm-alt linked an issue Mar 23, 2024 that may be closed by this pull request
6 tasks
Copy link

Pull reviewers stats

Stats of the last 30 days for popstellar:

User Total reviews Time to review Total comments
MariemBaccari
🥇
5
▀▀
1d 15h 8m
1
matteosz
🥈
4
4d 19h 33m
11
▀▀▀▀
Tyratox
🥉
3
6d 19h 13m
1
quadcopterman
3
1d 2h 12m
0
pierluca
2
1d 3h 52m
0
4xiom5
2
4d 20h 10m
0
sgueissa
2
4d 21h 28m
8
▀▀▀
K1li4nL
2
13d 21h 43m
▀▀
5
▀▀
emonnin-epfl
2
7h 27m
1
arnauds5
1
6h 55m
0
osm-alt
1
5h 52m
0
ljankoschek
1
20h 9m
0
onsriahi14
1
20d 14h 22m
▀▀▀
0
Kaz-ookid
1
4d 10h 8m
0
⚡️ Pull request stats

ljankoschek
ljankoschek previously approved these changes Mar 23, 2024
Copy link
Contributor

@ljankoschek ljankoschek left a comment

Choose a reason for hiding this comment

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

Looks good to me!

@osm-alt osm-alt requested a review from Tyratox March 23, 2024 20:21
Copy link
Contributor

@Tyratox Tyratox left a comment

Choose a reason for hiding this comment

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

Nice improvement! I think it would be nice to add a small tsdoc for the return value but also let me know what you think of my other remarks/questions :)

@@ -139,7 +139,10 @@ class NetworkManager {

if (alwaysPersistConnection) {
// always push the connection to the array so that we can re-connect later
this.connections.push(connection);
// if it doesn't already exist to avoid duplicates
Copy link
Contributor

Choose a reason for hiding this comment

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

Great improvement! Do you think it makes sense to use a set instead of an array?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Arrays in Typescript have useful functions that Sets do not.
I see that sets can be useful because of the uniqueness of their elements, but due to the above point, I'd say we keep it as an array. I don't think that checking if a connection already exists in the array is going to introduce much overhead considering that the array is probably not going to be that big.
What do you think?

Copy link
Contributor

Choose a reason for hiding this comment

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

I was just wondering since I would have assumed that we only need a small set of operations on that but if not we‘ll keep it, sure :)

@@ -162,14 +165,16 @@ class NetworkManager {
}
}

public disconnectFrom(address: string, intentional = true): void {
public disconnectFrom(address: string, intentional = true): Number {
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a tsdoc describing the return value? Also did you intentionally chose to return Number and not number? (https://stackoverflow.com/a/67155149)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The tsdoc can be useful to have.
No, it was not intentional and I just learned about the difference between them from the link you shared. Thank you. Will be switching to number instead.

Copy link

sonarcloud bot commented Mar 27, 2024

Quality Gate Passed Quality Gate passed for 'PoP - PoPCHA-Web-Client'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link

sonarcloud bot commented Mar 27, 2024

Quality Gate Passed Quality Gate passed for 'PoP - Be2-Scala'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link

sonarcloud bot commented Mar 27, 2024

Quality Gate Passed Quality Gate passed for 'PoP - Be1-Go'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link

sonarcloud bot commented Mar 27, 2024

Quality Gate Passed Quality Gate passed for 'PoP - Fe2-Android'

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
No data about Duplication

See analysis details on SonarCloud

Copy link

sonarcloud bot commented Mar 27, 2024

@osm-alt osm-alt merged commit 97b3505 into master Mar 28, 2024
18 checks passed
@osm-alt osm-alt deleted the work-fe1-omajzoub-change-disconnect-from-all branch March 28, 2024 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Fe-1 disconnects from all connections if only one connection dies
3 participants