diff options
| author | Shulhan <ms@kilabit.info> | 2026-01-25 23:51:06 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2026-01-25 23:56:55 +0700 |
| commit | fba3fd5a7cce5fa17a9446f6ed2a72d56cfe1fa4 (patch) | |
| tree | f6e01024595226d702374f7ba2dfd9f23fae3887 | |
| parent | 462ae78a1fa9880ca443adc19714d2aaf099b1ac (diff) | |
| download | pakakeh.go-fba3fd5a7cce5fa17a9446f6ed2a72d56cfe1fa4.tar.xz | |
lib/dns: increase the client default timeout from 6 to 60 seconds
The 6 seconds timeout will works only on fast, stable connection.
On some environment with bad network connection, it will cause I/O timeout
during recv and this affect the whole internet connections, like
browsing.
Since the browser wait for domain to be resolved but it does
not get the response, it send another query.
The next query also got timeout again.
Increasing to 10-30 seconds also does not help on that environment.
After some tests, 60 seconds is the lower timeout limit that reduce
the I/O timeout.
It is better that we receive the response and store it to caches, so
the next query can be handled quickly, rather than timeout and retrying
with the same error.
| -rw-r--r-- | CHANGELOG.adoc | 19 | ||||
| -rw-r--r-- | lib/dns/dns.go | 2 |
2 files changed, 20 insertions, 1 deletions
diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index 8882bcbb..25bc11f6 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -38,6 +38,25 @@ Legend, [#v0_61_0] == pakakeh.go v0.61.0 (2026-xx-xx) +**🌼 lib/dns: increase the client default timeout from 6 to 60 seconds** + +The 6 seconds timeout will works only on fast, stable connection. + +On some environment with bad network connection, it will cause I/O timeout +during recv and this affect the whole internet connections, like +browsing. +Since the browser wait for domain to be resolved but it does +not get the response, it send another query. +The next query also got timeout again. + +Increasing to 10-30 seconds also does not help on that environment. +After some tests, 60 seconds is the lower timeout limit that reduce +the I/O timeout. + +It is better that we receive the response and store it to caches, so +the next query can be handled quickly, rather than timeout and retrying +with the same error. + **🌼 lib/test: export the constant for default data file name suffix** Also, fix typo on the LoadDataDir regarding suffix by replacing it with diff --git a/lib/dns/dns.go b/lib/dns/dns.go index 7a19a724..5e9395d6 100644 --- a/lib/dns/dns.go +++ b/lib/dns/dns.go @@ -63,7 +63,7 @@ var ( var ( // clientTimeout define read and write timeout on client request. - clientTimeout = 6 * time.Second + clientTimeout = 60 * time.Second ) type connType byte |
