Connection timeout for sync not working

My Internet connection died and Joplin tried to sync for several minutes. Thus I clicked on Cancel. The text Cancelling... appeared in the status area, but nothing happend and the sync symbol was still rotating continuously.
In the meantime Joplin uses 18% CPU. After another 5 minutes I had to quit Joplin to get out of this situation. Although as soon as you start Joplin, it tries to sync and it starts all over again.

Somehow there’s no timeout set for trying to establish a connection. Or if a timeout is set in the code, it’s not working.
The second issue is that the cancel obviously does not work.

So basically I had to quit Joplin until my Internet connection was up again.

(Env: macOS 10.14.5, Joplin git master)

In some cases, connections indeed never time out for some reason, that’s particularly true with malfunctioning proxies.

As for cancel, it’s designed to cancel gracefully, once the current item is done processing but if something is blocking like never ending timeout it doesn’t work.

(Hmm, I’m not using a proxy…)

Anyway, is there something we can do to fix this? It is a serious problem, when Joplin uses 18% CPU on my 2.9 GHz Intel Core i9 MacBook Pro for no good reason.
Syncing or cancelling the sync for hours and showing me an animated icon is rather distracting in such a situation.