From b9e85695db80bef00172f95dde6b7a68572513a3 Mon Sep 17 00:00:00 2001 From: Ainar Garipov Date: Wed, 14 Jul 2021 21:03:56 +0300 Subject: [PATCH] Pull request: 2145 optimistic cache Updates #2145. Squashed commit of the following: commit 0c15347f4573252849817f27f290c0d45381454c Merge: 98bd3b89 ebade2b6 Author: Ainar Garipov Date: Wed Jul 14 20:44:58 2021 +0300 Merge branch 'master' into 2145-optimistic-cache commit 98bd3b895e0d881d5234f674b54f9fa7847dc8f0 Author: Ildar Kamalov Date: Wed Jul 14 13:12:56 2021 +0300 client: handle optimistic cache commit 0b469b72ffd43d736dbf139e7d47b23b9fa877c5 Author: Eugene Burkov Date: Thu Jul 1 19:01:01 2021 +0300 openapi: fix log of changes commit f1594e7f7567e0278b08025a8e4da901ef330602 Merge: a034eb98 e113b276 Author: Eugene Burkov Date: Thu Jul 1 18:53:01 2021 +0300 Merge branch 'master' into 2145-optimistic-cache commit a034eb98bafdca90befad7dfb6a9b0e4c939c879 Author: Eugene Burkov Date: Tue Jun 29 18:45:28 2021 +0300 dnsforward: fix tests commit c72227f83c849714721c3512beeb9d1b800a7225 Author: Eugene Burkov Date: Tue Jun 29 18:33:12 2021 +0300 openapi: imp docs commit 35fe0d2a8c98d007b8ac48653c18d10d52e72dce Author: Eugene Burkov Date: Mon Jun 28 14:19:46 2021 +0300 dnsforward: add optimistic cache --- CHANGELOG.md | 9 ++-- client/src/__locales/en.json | 2 + .../src/components/Settings/Dns/Cache/Form.js | 53 +++++++++++++------ .../components/Settings/Dns/Cache/index.js | 3 +- internal/dnsforward/config.go | 3 ++ internal/dnsforward/http.go | 8 +++ internal/dnsforward/http_test.go | 4 +- ...> TestDNSForwardHTTP_handleGetConfig.json} | 3 ++ ...> TestDNSForwardHTTP_handleSetConfig.json} | 16 ++++++ openapi/CHANGELOG.md | 8 +++ openapi/openapi.yaml | 2 + 11 files changed, 86 insertions(+), 25 deletions(-) rename internal/dnsforward/testdata/{TestDNSForwardHTTTP_handleGetConfig.json => TestDNSForwardHTTP_handleGetConfig.json} (95%) rename internal/dnsforward/testdata/{TestDNSForwardHTTTP_handleSetConfig.json => TestDNSForwardHTTP_handleSetConfig.json} (95%) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4bd11cc1..0903fdbf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,11 +10,12 @@ and this project adheres to ## [Unreleased] ### Added +- Optimistic cache ([#2145]). - New possible value of `6h` for `querylog_interval` setting ([#2504]). - Blocking access using client IDs ([#2624], [#3162]). - `source` directives support in `/etc/network/interfaces` on Linux ([#3257]). @@ -53,11 +54,6 @@ and this project adheres to ### Deprecated - - - Go 1.16 support. v0.108.0 will require at least Go 1.17 to build. ### Fixed @@ -83,6 +79,7 @@ released by then. [#1381]: https://github.com/AdguardTeam/AdGuardHome/issues/1381 [#1691]: https://github.com/AdguardTeam/AdGuardHome/issues/1691 [#2141]: https://github.com/AdguardTeam/AdGuardHome/issues/2141 +[#2145]: https://github.com/AdguardTeam/AdGuardHome/issues/2145 [#2280]: https://github.com/AdguardTeam/AdGuardHome/issues/2280 [#2439]: https://github.com/AdguardTeam/AdGuardHome/issues/2439 [#2441]: https://github.com/AdguardTeam/AdGuardHome/issues/2441 diff --git a/client/src/__locales/en.json b/client/src/__locales/en.json index 8254c9ea..246f19c7 100644 --- a/client/src/__locales/en.json +++ b/client/src/__locales/en.json @@ -597,6 +597,8 @@ "cache_ttl_min_override_desc": "Extend short time-to-live values (seconds) received from the upstream server when caching DNS responses", "cache_ttl_max_override_desc": "Set a maximum time-to-live value (seconds) for entries in the DNS cache", "ttl_cache_validation": "Minimum cache TTL value must be less than or equal to the maximum value", + "cache_optimistic": "Optimistic", + "cache_optimistic_desc": "Make AdGuard Home respond from the cache even when the entries are expired and also try to refresh them.", "filter_category_general": "General", "filter_category_security": "Security", "filter_category_regional": "Regional", diff --git a/client/src/components/Settings/Dns/Cache/Form.js b/client/src/components/Settings/Dns/Cache/Form.js index 9a13ec63..5b0fe6a2 100644 --- a/client/src/components/Settings/Dns/Cache/Form.js +++ b/client/src/components/Settings/Dns/Cache/Form.js @@ -3,7 +3,7 @@ import PropTypes from 'prop-types'; import { Field, reduxForm } from 'redux-form'; import { Trans, useTranslation } from 'react-i18next'; import { shallowEqual, useSelector } from 'react-redux'; -import { renderInputField, toNumber } from '../../../../helpers/form'; +import { renderInputField, toNumber, CheckboxField } from '../../../../helpers/form'; import { CACHE_CONFIG_FIELDS, FORM_NAME, UINT32_RANGE } from '../../../../helpers/constants'; import { replaceZeroWithEmptyString } from '../../../../helpers/helpers'; @@ -47,27 +47,48 @@ const Form = ({ }) =>
- +
{t(description)}
)} - {minExceedsMax - && {t('ttl_cache_validation')}} + {minExceedsMax && ( + + {t('ttl_cache_validation')} + + )} + +
+
+
+ +
+