Commit c49a0f5
Configuration Provider Cancellation Refactor (#78)
* Add Configuration Overloads without Cancellation
Updates the cofiguration builder extensions to allow adding the consul
configuration provider without specifying a cancellation token. If no
token is provided then the default cancellation token is used instead.
* Cancel Watching if Config Provider Disposed
Add an `IDisposable` implemnetation to the `ConsulConfigurationProvider`.
When disposed the provider cancels the watch of the KV node. This
brings the cancellation behavior more in line with that of other config
providers.
There are still a few open questions with this however:
* The cancellation token source _and_ chnage token registration are a
bit clunky. Ideally we could just have one or the other but the
change token doesn't cancel the watch properly if that's all we
have.
* Ideally if we _do_ need two cancellation tokens, one from the source
and one to pass along the `Dispose` call we would combine them with
`CancellationTokenSource.CreateLinkedTokenSource` rather than the
registration we have right now. This may work better if the watching
of the KV node is moved more into the configuration provider.
* Remove `CancellationToken` from `ConsulConfigurationSource`
With the `IDisposable` support for the `ConsulConfiugrationProvider`
this token is no longer needed.
semver: breaking.
* Fixup Unit Test Mocking
Switch to accepting any cancellation token to fixup the failing test
cases
* Switch to Task for Polling Changes
Move away from using change tokens to provide better `async` support
when checking for changes. This brings the polling for changes more in
line with other config providers with background polling task.
* Fixup Documentation Violations
* Address Race in Reload Test
Fixup the race between the test and the background task performing a
reload.
* Make `PollWaitTime` Configurable
Addresses the confugrability of the wait when polling for
changes. Asrequested in PR comments.
* Extract Polling into Separate Method
This runs the first part of the poll within the context of the
constructor to bring the behaviour back in line with the origional
changetoken based polling.
* Code Review Fixups
Address issues from PR review.
* Refactor to remove ConsulConfigurationClient class.
* Re-add net461 and add test for default KeyToRemove.
* Fix comments.1 parent 9888d29 commit c49a0f5
13 files changed
Lines changed: 753 additions & 748 deletions
File tree
- src/Winton.Extensions.Configuration.Consul
- Extensions
- test
- Website
- Winton.Extensions.Configuration.Consul.Test
- Extensions
Lines changed: 4 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
22 | | - | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | 22 | | |
27 | 23 | | |
28 | 24 | | |
29 | | - | |
30 | | - | |
| 25 | + | |
31 | 26 | | |
32 | | - | |
| 27 | + | |
33 | 28 | | |
34 | 29 | | |
35 | 30 | | |
| |||
38 | 33 | | |
39 | 34 | | |
40 | 35 | | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | 36 | | |
46 | 37 | | |
47 | 38 | | |
48 | 39 | | |
49 | 40 | | |
50 | | - | |
51 | 41 | | |
52 | 42 | | |
53 | | - | |
| 43 | + | |
54 | 44 | | |
55 | 45 | | |
56 | 46 | | |
57 | 47 | | |
58 | | - | |
| 48 | + | |
Lines changed: 0 additions & 126 deletions
This file was deleted.
Lines changed: 119 additions & 36 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | | - | |
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | 13 | | |
14 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
15 | 24 | | |
16 | | - | |
| 25 | + | |
| 26 | + | |
17 | 27 | | |
| 28 | + | |
| 29 | + | |
18 | 30 | | |
19 | 31 | | |
20 | 32 | | |
21 | | - | |
| 33 | + | |
22 | 34 | | |
23 | 35 | | |
24 | 36 | | |
25 | 37 | | |
26 | 38 | | |
27 | 39 | | |
28 | | - | |
29 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
30 | 44 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
41 | 50 | | |
42 | 51 | | |
43 | 52 | | |
44 | 53 | | |
45 | | - | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
46 | 67 | | |
47 | 68 | | |
48 | | - | |
| 69 | + | |
49 | 70 | | |
50 | 71 | | |
51 | 72 | | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
| 73 | + | |
62 | 74 | | |
63 | | - | |
64 | | - | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
65 | 82 | | |
66 | 83 | | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
| 84 | + | |
73 | 85 | | |
74 | 86 | | |
75 | 87 | | |
| |||
81 | 93 | | |
82 | 94 | | |
83 | 95 | | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
84 | 167 | | |
85 | 168 | | |
0 commit comments