diff options
author | Craig Tiller <ctiller@google.com> | 2016-03-11 09:52:42 -0800 |
---|---|---|
committer | Craig Tiller <ctiller@google.com> | 2016-03-11 09:52:42 -0800 |
commit | e2327dbb8e45936c81802119142a7cda28230f24 (patch) | |
tree | 8a426dacc675479323c5808433a289625d93f82b | |
parent | 1e55bd455d5fa901e19c1ccf64996c0adc7a4584 (diff) |
Fit and finish for dns retry loop
-rw-r--r-- | build.yaml | 1 | ||||
-rw-r--r-- | src/core/client_config/resolvers/dns_resolver.c | 8 | ||||
-rw-r--r-- | tools/run_tests/tests.json | 2 |
3 files changed, 8 insertions, 3 deletions
diff --git a/build.yaml b/build.yaml index 7cafb0ac6f..e003dd8339 100644 --- a/build.yaml +++ b/build.yaml @@ -1058,6 +1058,7 @@ targets: - gpr_test_util - gpr - name: dns_resolver_connectivity_test + cpu_cost: 0.1 build: test language: c src: diff --git a/src/core/client_config/resolvers/dns_resolver.c b/src/core/client_config/resolvers/dns_resolver.c index 55457647b3..e28e4757a1 100644 --- a/src/core/client_config/resolvers/dns_resolver.c +++ b/src/core/client_config/resolvers/dns_resolver.c @@ -95,6 +95,9 @@ static const grpc_resolver_vtable dns_resolver_vtable = { static void dns_shutdown(grpc_exec_ctx *exec_ctx, grpc_resolver *resolver) { dns_resolver *r = (dns_resolver *)resolver; gpr_mu_lock(&r->mu); + if (r->have_retry_timer) { + grpc_timer_cancel(exec_ctx, &r->retry_timer); + } if (r->next_completion != NULL) { *r->target_config = NULL; grpc_exec_ctx_enqueue(exec_ctx, r->next_completion, true, NULL); @@ -133,13 +136,14 @@ static void dns_on_retry_timer(grpc_exec_ctx *exec_ctx, void *arg, bool success) { dns_resolver *r = arg; + gpr_mu_lock(&r->mu); + r->have_retry_timer = false; if (success) { - gpr_mu_lock(&r->mu); if (!r->resolving) { dns_start_resolving_locked(r); } - gpr_mu_unlock(&r->mu); } + gpr_mu_unlock(&r->mu); GRPC_RESOLVER_UNREF(exec_ctx, &r->base, "retry-timer"); } diff --git a/tools/run_tests/tests.json b/tools/run_tests/tests.json index c2d6cadd53..724cd64d19 100644 --- a/tools/run_tests/tests.json +++ b/tools/run_tests/tests.json @@ -261,7 +261,7 @@ "posix", "windows" ], - "cpu_cost": 1.0, + "cpu_cost": 0.1, "exclude_configs": [], "flaky": false, "gtest": false, |