GothenburgBitFactory / taskwarrior

Taskwarrior - Command line Task Management
https://taskwarrior.org
MIT License
4.45k stars 305 forks source link

reduce t sync connection timeout #2860

Closed dgrabla closed 5 months ago

dgrabla commented 2 years ago

I've been looking for a way to reduce the connection timeout of the sync command but I could not find a way to change it.

I found references on the codebase to GNUTLS_DEFAULT_HANDSHAKE_TIMEOUT but setting this envvar to for example 1000 doesn't seem to do anything.

I tried setting a configuration for the host on the .ssh/config but I have the feeling taskwarrior does not use it

[~]> t rc.debug.tls=9 sync  
c: INFO Server certificate will be verified.
c: 3 ASSERT: ../../../lib/x509/dn.c[_gnutls_x509_compare_raw_dn]:1025
c: 3 ASSERT: ../../../lib/x509/x509_ext.c[gnutls_subject_alt_names_get]:111
c: 3 ASSERT: ../../../lib/x509/x509.c[get_alt_name]:1848
c: 3 ASSERT: ../../../lib/nettle/mpi.c[wrap_nettle_mpi_print]:60
c: 5 REC[0x55f0a9e3e960]: Allocating epoch #0
c: 2 added 6 protocols, 29 ciphersuites, 19 sig algos and 10 groups into priority list

[LOOOONG WAIT TILL TIMEOUT. CONTROL-C doesn't abort. Sending a SIGINT is also ignored. Only killable with a kill -9]
(...)

(eventually) Sync failed.  Could not connect to the Taskserver.

WHY

I have 't sync' hooked to my suspend/hibernation scripts to do a last sync before closing the session. If taskd is unreachable for whatever reason the default timeout used by taskwarrior or maybe by the system is, in my opinion, too long.

WHAT

Did I overlooked a way to tell taskwarrior to abort / timeout earlier? If not, is there a wrapper, some kind of program I could use to do this? Or a global configuration (on maybe gnutls)?

Pinging @djmitche as I read he is working on a sync overhaul and hopefully he has an answer on top of his head

djmitche commented 7 months ago

Somehow I missed this. The new approach doesn't fix this, but this would be a good thing to address. Maybe we should have a max sync time config, and just kill the process after that time?

dgrabla commented 7 months ago

Oh I missed the 3.0 release. Yeah, It would be awesome to add that feature on the next patch, thank you very much.

djmitche commented 5 months ago

Let's see if this turns out to be a problem with 3.0. I think reqwest has a built-in timeout.