I am not sure how Joplin begins with the syncing process. But I have noticed that it sometimes indefinitely keeps on syncing even when my PC has no internet connection.
I think the best approach will be to first detect whether the device has internet connection and only then initiate the syncing process.
And this detection should not be the one-time process. Joplin should detect the network every time it tries to initiate syncing.
Obviously it is case specific, if I am syncing locally, then there is no need for internet connection. So a condition can be set where Joplin will attempt to detect network in cases where a user is depending on internet to sync files.
I am not sure if this approach is already being used in Joplin, and if it is, then I think Joplin should not keep syncing till eternity even though there is no network.