|
2 | 2 | // Licensed under the Apache License, Version 2.0. See LICENCE in the project root for license information. |
3 | 3 |
|
4 | 4 | using System; |
5 | | -using System.Collections.Generic; |
6 | 5 | using System.Net; |
7 | 6 | using System.Threading; |
8 | 7 | using System.Threading.Tasks; |
@@ -32,13 +31,19 @@ public async Task<QueryResult<KVPair[]>> GetConfig(string key, CancellationToken |
32 | 31 | return result; |
33 | 32 | } |
34 | 33 |
|
35 | | - public IChangeToken Watch(string key, Action<ConsulWatchExceptionContext> onException, CancellationToken cancellationToken) |
| 34 | + public IChangeToken Watch( |
| 35 | + string key, |
| 36 | + Action<ConsulWatchExceptionContext> onException, |
| 37 | + CancellationToken cancellationToken) |
36 | 38 | { |
37 | 39 | Task.Run(() => PollForChanges(key, onException, cancellationToken)); |
38 | 40 | return _reloadToken; |
39 | 41 | } |
40 | 42 |
|
41 | | - private async Task<QueryResult<KVPair[]>> GetKvPairs(string key, CancellationToken cancellationToken, QueryOptions queryOptions = null) |
| 43 | + private async Task<QueryResult<KVPair[]>> GetKvPairs( |
| 44 | + string key, |
| 45 | + CancellationToken cancellationToken, |
| 46 | + QueryOptions queryOptions = null) |
42 | 47 | { |
43 | 48 | using (IConsulClient consulClient = _consulClientFactory.Create()) |
44 | 49 | { |
@@ -72,7 +77,10 @@ private async Task<bool> HasValueChanged(string key, CancellationToken cancellat |
72 | 77 | return result != null && UpdateLastIndex(result); |
73 | 78 | } |
74 | 79 |
|
75 | | - private async Task PollForChanges(string key, Action<ConsulWatchExceptionContext> onException, CancellationToken cancellationToken) |
| 80 | + private async Task PollForChanges( |
| 81 | + string key, |
| 82 | + Action<ConsulWatchExceptionContext> onException, |
| 83 | + CancellationToken cancellationToken) |
76 | 84 | { |
77 | 85 | while (!cancellationToken.IsCancellationRequested) |
78 | 86 | { |
|
0 commit comments