fix(default-flatpaks): Couldn't resolve host name
in some network setups
#352
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes: #346
This is the attempt to fix this
default-flatpaks
error in some network setups (when internet connection is not yet fully established when service is started).If
network-online.target
in service is not sufficient, network is checked 3 times with 3 seconds pause.I use the same server which Fedora uses to check the connection.
I also modified the setup, so internet-dependent tasks like adding remotes & installing flatpaks will be just skipped if there is no internet connection, while rest of the offline tasks will be performed.
StartLimitInterval=0
is currently set to infinitely restart the setup until it performs without any errors. This can be problematic if users don't have the internet connection for some good period of time, so I set this to3
, which is sufficient enough imo.The only thing that is not implemented right now, is that setup doesn't retry on those skipped operations due to no internet connection, because it would then skip other offline operations. So using
exit 1
is not sufficient.It's also tricky that adding remote task can't be skipped if it's already present, as flatpakref & repo URL are not the same for comparison. So we would needlessly restart the setup in this scenario if user doesn't have internet, but has the same remote already present.
It also should be noted that
Restart-on-failure
doesn't always trigger for some errors (like it doesn't trigger inCouldn't resolve host name
when adding remote).Because of that complexity, I won't implement that.
I tested this locally & it works well.