orgzly / orgzly-android

Outliner for taking notes and managing to-do lists
https://www.orgzly.com
GNU General Public License v3.0
2.7k stars 305 forks source link

WIP Introduce custom timeout for server connection (#870) #876

Closed benjaminor closed 3 years ago

benjaminor commented 3 years ago

Hey, I think this pull request would do the job of enabling a custom timeout for WebDAV repos which have a problem when syncing because the server is too slow (see #870).

This change would use a user-defined value (in seconds) for all three different timeouts which one can set with OkHttp (connectTimeout, readTimeout, writeTimeout). I thought this would be better for simplicity.

UI would look like this: customTimeout

I've tested this with my nextcloud, it seems to be working so far.

benjaminor commented 3 years ago

Alright, I think these changes would do the job.

I've tested them succesfully on Android-Studio and on my own device which runs Android 8.

On the other hand, I'm having second thoughts about adding complexity for a feature that is, judging from the issue #870, not much asked for (admittedly I don't have the issue anymore, too). I'll close the pull request for now, feel free to open it again if you have a different opinion.

P.S.: For a simpler change, one could only set the timeouts to a new, fixed value (say 20 seconds, at the moment the default of OkHttp is 10 seconds) in the WebdavRepo.kt file: https://github.com/orgzly/orgzly-android/blob/44004abbbf9fc3020d19aee144debf9c9fb715b2/app/src/main/java/com/orgzly/android/repos/WebdavRepo.kt#L49-L56 and leave aside the logic to let the user customize the timeouts.

nevenz commented 3 years ago

I've doubled the values for now, we can see how that goes and add preferences later, thanks.