-
-
Notifications
You must be signed in to change notification settings - Fork 480
[Refactor] Offline detection #1727
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
Conversation
For me the idea looks promising. Code vice also pretty good.
|
I'm planning to add a helper method like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested and it works. I wonder if we really need the retry. It is going on forever. It is somehow really annoying to see the timer all the time. We should be silent till the user trys something what needs internet.
Is it also possible to log less informations. Lets say just a message that we retry in 25 secs. Don't log every secs count?
My log:
(14:33:37) INFO: [Connection]: Connectivity: check-online
(14:33:37) INFO: [Connection]: Pinging external endpoints
(14:33:37) INFO: [Legendary]: Running command: /home/niklas/Repository/HeroicGamesLauncher/public/bin/linux/legendary --version
(14:33:37) INFO: [Connection]: All ping requests failed:
(14:33:37) INFO: [Connection]: {}
(14:33:37) INFO: [Connection]: Retrying in: 5 seconds
(14:33:37) INFO: [Legendary]: Legendary location: /home/niklas/Repository/HeroicGamesLauncher/public/bin/linux/legendary
(14:33:37) INFO: [Gog]: GOGDL location: /home/niklas/Repository/HeroicGamesLauncher/public/bin/linux/gogdl
(14:33:37) INFO: [Backend]:
Heroic Version: 2.4.3 Chopper
Legendary Version: 0.20.28 Dark Energy (hotfix #2)
OS: Pop KERNEL: 5.19.0-76051900-generic ARCH: x64
CPU: AMD Ryzen 7 3700X 8-Core Processor @3.6 GOVERNOR: schedutil
RAM: Total: 15.57 GiB Available: 11.25 GiB
GRAPHICS: GPU0: NVIDIA GeForce RTX 2060 SUPER VRAM: 8192MB DRIVER: 515.65.01
PROTOCOL: x11
(14:33:37) WARNING: [Backend]: Failed to register protocol with OS.
(node:39819) ExtensionLoadWarning: Warnings loading extension at /home/niklas/.config/heroic/extensions/fmkadmapgofadopljbjfkapdkoienihi:
Manifest version 2 is deprecated, and support will be removed in 2023. See https://developer.chrome.com/blog/mv2-transition/ for more details.
(Use `electron --trace-warnings ...` to show where the warning was created)
[39819:0916/143338.104051:ERROR:browser_main_loop.cc(270)] Gtk: gtk_widget_add_accelerator: assertion 'GTK_IS_ACCEL_GROUP (accel_group)' failed
[39819:0916/143338.104129:ERROR:browser_main_loop.cc(270)] Gtk: gtk_widget_add_accelerator: assertion 'GTK_IS_ACCEL_GROUP (accel_group)' failed
[39819:0916/143338.104175:ERROR:browser_main_loop.cc(270)] Gtk: gtk_widget_add_accelerator: assertion 'GTK_IS_ACCEL_GROUP (accel_group)' failed
[39819:0916/143338.522939:ERROR:CONSOLE(160)] "Electron sandbox_bundle.js script failed to run", source: node:electron/js2c/sandbox_bundle (160)
[39819:0916/143338.522969:ERROR:CONSOLE(160)] "TypeError: object null is not iterable (cannot read property Symbol(Symbol.iterator))", source: node:electron/js2c/sandbox_bundle (160)
(14:33:38) INFO: [Connection]: Retrying in: 4 seconds
(14:33:39) INFO: [Connection]: Retrying in: 3 seconds
(14:33:40) WARNING: [DXVKInstaller]: App offline, skipping possible DXVK update.
(14:33:40) INFO: [Connection]: Retrying in: 2 seconds
(14:33:40) INFO: [Backend]: Checking for new Heroic Updates
(14:33:40) ERROR: [Backend]: Error when checking for Heroic updates Error: getaddrinfo ENOTFOUND api.github.com
(14:33:40) INFO: [Frontend]: Refreshing Library
(14:33:40) INFO: [Legendary]: Refreshing library...
(14:33:40) INFO: [Legendary]: Refreshing Epic Games...
(14:33:40) INFO: [Legendary]: Game list updated, got 86 games & DLCs
(14:33:40) ERROR: [Backend]: Failed to get epic service status with Error: getaddrinfo ENOTFOUND status.epicgames.com
(14:33:40) INFO: [Legendary]: Running command: /home/niklas/Repository/HeroicGamesLauncher/public/bin/linux/legendary list
(14:33:41) INFO: [Connection]: Retrying in: 1 seconds
(14:33:42) INFO: [Connection]: Retrying in: 0 seconds
(14:33:42) INFO: [Connection]: Pinging external endpoints
(14:33:42) INFO: [Connection]: All ping requests failed:
(14:33:42) INFO: [Connection]: {}
(14:33:42) INFO: [Connection]: Retrying in: 10 seconds
(14:33:43) INFO: [Connection]: Retrying in: 9 seconds
(14:33:44) INFO: [Connection]: Retrying in: 8 seconds
(14:33:45) INFO: [Connection]: Retrying in: 7 seconds
(14:33:46) INFO: [Connection]: Retrying in: 6 seconds
(14:33:47) INFO: [Connection]: Retrying in: 5 seconds
(14:33:48) INFO: [Connection]: Retrying in: 4 seconds
(14:33:49) INFO: [Connection]: Retrying in: 3 seconds
(14:33:50) INFO: [Connection]: Retrying in: 2 seconds
(14:33:51) INFO: [Connection]: Retrying in: 1 seconds
(14:33:52) INFO: [Connection]: Retrying in: 0 seconds
(14:33:52) INFO: [Connection]: Pinging external endpoints
(14:33:52) INFO: [Connection]: All ping requests failed:
(14:33:52) INFO: [Connection]: {}
(14:33:52) INFO: [Connection]: Retrying in: 15 seconds
(14:33:53) INFO: [Connection]: Retrying in: 14 seconds
(14:33:54) INFO: [Connection]: Retrying in: 13 seconds
(14:33:55) INFO: [Connection]: Retrying in: 12 seconds
(14:33:56) INFO: [Connection]: Retrying in: 11 seconds
(14:33:57) INFO: [Connection]: Retrying in: 10 seconds
(14:33:58) INFO: [Connection]: Retrying in: 9 seconds
(14:33:59) INFO: [Connection]: Retrying in: 8 seconds
(14:34:00) INFO: [Connection]: Retrying in: 7 seconds
(14:34:01) INFO: [Connection]: Retrying in: 6 seconds
(14:34:02) INFO: [Connection]: Retrying in: 5 seconds
(14:34:03) INFO: [Connection]: Retrying in: 4 seconds
(14:34:04) INFO: [Connection]: Retrying in: 3 seconds
(14:34:05) INFO: [Connection]: Retrying in: 2 seconds
(14:34:06) INFO: [Connection]: Retrying in: 1 seconds
(14:34:07) INFO: [Connection]: Retrying in: 0 seconds
(14:34:07) INFO: [Connection]: Pinging external endpoints
(14:34:07) INFO: [Connection]: All ping requests failed:
(14:34:07) INFO: [Connection]: {}
(14:34:07) INFO: [Connection]: Retrying in: 20 seconds
(14:34:08) INFO: [Connection]: Retrying in: 19 seconds
(14:34:09) INFO: [Connection]: Retrying in: 18 seconds
(14:34:10) INFO: [Connection]: Retrying in: 17 seconds
(14:34:11) INFO: [Connection]: Retrying in: 16 seconds
(14:34:12) INFO: [Connection]: Retrying in: 15 seconds
(14:34:13) INFO: [Connection]: Retrying in: 14 seconds
(14:34:14) INFO: [Connection]: Retrying in: 13 seconds
(14:34:15) INFO: [Connection]: Retrying in: 12 seconds
(14:34:16) INFO: [Connection]: Retrying in: 11 seconds
(14:34:17) INFO: [Connection]: Retrying in: 10 seconds
(14:34:18) INFO: [Connection]: Retrying in: 9 seconds
(14:34:19) INFO: [Connection]: Retrying in: 8 seconds
(14:34:20) INFO: [Connection]: Retrying in: 7 seconds
(14:34:21) INFO: [Connection]: Retrying in: 6 seconds
(14:34:22) INFO: [Connection]: Retrying in: 5 seconds
(14:34:23) INFO: [Connection]: Retrying in: 4 seconds
(14:34:24) INFO: [Connection]: Retrying in: 3 seconds
(14:34:25) INFO: [Connection]: Connectivity: check-online
(14:34:25) INFO: [Connection]: Pinging external endpoints
(14:34:25) INFO: [Connection]: All ping requests failed:
(14:34:25) INFO: [Connection]: {}
(14:34:25) INFO: [Connection]: Retrying in: 25 seconds
(14:34:25) INFO: [Connection]: Retrying in: 2 seconds
(14:34:26) INFO: [Connection]: Retrying in: 24 seconds
(14:34:26) INFO: [Connection]: Retrying in: 1 seconds
(14:34:27) INFO: [Connection]: Retrying in: 23 seconds
(14:34:27) INFO: [Connection]: Retrying in: 0 seconds
(14:34:27) INFO: [Connection]: Pinging external endpoints
(14:34:27) INFO: [Connection]: Connectivity: online
(14:34:27) INFO: [Gog]: Getting data about the user
(14:34:27) INFO: [Backend]: AreWeAntiCheatYet data downloaded
(14:34:28) INFO: [Gog]: Saved user data to config
Should this be maybe also merged against beta, so we can test this more in a beta release?
Overall really good stuff and nice code :).
I was planning a
sure!
I'll change it to beta today, I forgot about that (I started this against main and forgot about it hahah) |
446ea25
to
0ed4245
Compare
@Nocccer moved this to be against beta, removed the seconds retry log, I'll leave the dismiss (and other features) for after this is merged |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I found a small frontend ui problem, where the showed seconds jump between random numbers and not counting down as expected. Here is a video. I start heroic without internet and after a time i connect internet again. At this moment numbers jumping
simplescreenrecorder-2022-09-21_19.43.20.mp4
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is cool. Definitely an important feature covering the case where connection drops out or the user starts the app offline but then goes online after launch without having to restart the app. I tested on windows 11, and it is working for me. Left some comments.
@Nocccer can you check if the issue is still present? I was not sure how to reproduce it so I just added a check to make sure any previous timeout is stopped after starting a new timeout just in case |
I still have the number bug. Here is a log. I just added a
You can see that at seconds 11 i got the connection back and the retry seconds get up to 20. Also a big problem is that if i start heroic without internet, it always start with retry. Should it not be just showing offline and should retry if the connection is back again? |
@Nocccer thanks, I think I fixed the counter issue now, I was able to reproduce it and now it should revert back to 5 seconds after an online or offline event properly. I also changed it to not start retrying if it's currently offline. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Works like a charm now :). Really good stuff
This PR adds the offline/online detection + ping + event handling
Done:
offline
andonline
events to detect when a network connection is active/inactiveconnectivity
state that we can use anywhere if needed to show connectivity-related message (or to disable actions like opening a website or logging in for example)online
eventonce
to do things at boot waiting for the connection to be available and only onceTODO after merging this:
I added a
checkConnectivity
function exported in online_monitor.ts that could be called after doing something that relies on an external request and we detect the connection failed. I didn't add this in this PR since I don't really know all the places where this can happen. I think it's better to start adding this calls tocheckConnectivity
when things fail as we find them.TODO (I'll leave these things for the future maybe, this is more like polishing):
Use the following Checklist if you have changed something on the Backend or Frontend: