nextcloud / nextcloud/desktop

Delay errors about missing connectivity after start-up

Open
#5,424 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
3.9k
Forks
1k
Avg merge
1d 17h
Merged PRs (30d)
123

Description

### Feature description
tl;dr: Do not issue any connectivity related errors within the first 60s of system boot time.
## The problem
On system start-up, the establishment of on internet connection may be delayed due to a number of factors. Chief among them being VPNs, especially in a corporate environment.

The Nextcloud Desktop Client is fairly lean and starts up rather quickly, before the proper authentication is completed to connect my system via a VPN to the outside. As a result, every time I boot up the computer, I am greeted with Nextcloud complaining about a missing connection. After 10 seconds or so Nextcloud successfully connects to the Nextcloud server, with the error still displayed, as it is a system message.

![image](https://user-images.githubusercontent.com/60887273/217971535-be35b437-4bb3-4425-85fb-7e8c13ecf365.png)
> Nextcloud Desktop Client Version 3.6.6 (Windows)

A bunch of file-sync programs show this behavior, another one being https://github.com/duplicati/duplicati. It is a fairly jarring experience, being greeted each startup with connection errors from different sync solutions, even though 20 secs later everything is fine.

## The solution
Of course, this is nothing that cannot be solved with a one-liner `sleep()` command in a shell script, however, I think this could be solved more elegantly: Getting time-since-boot is fairly simple with OS specific APIs. [Eg. doc entry for Windows](https://learn.microsoft.com/en-us/windows/win32/api/sysinfoapi/nf-sysinfoapi-gettickcount64?redirectedfrom=MSDN). With that time, errors could be prevented from being issued. The logical next step would be to check time since logon, the number that actually more closely represents how a user interacts with a PC and base the 60s delay off of that.

## required fail-safes
Especially on system boot is where NTP updates happen, so there is the danger of checking time and getting stuck in this no error state for a very long time due to sudden time zone shifts. An internal 60s timer should be started additionally, in case the time since boot calculation returns a bad result.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.