Skip to content

Commit

Permalink
Address sonarqube warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
serialseb committed Mar 5, 2017
1 parent c47c70b commit 9c4bb05
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions src/ConsulStructure/Structure.BlockingHttpWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class BlockingHttpWatcher
await Task.Delay(backoff, disposer);
backoff = TimeSpan.FromSeconds(Math.Min(maxBackoff, Math.Exp(backoff.TotalSeconds)));
} while (disposer.IsCancellationRequested == false);
} while (!disposer.IsCancellationRequested);
return NullMessage;
};
Expand Down Expand Up @@ -91,10 +91,10 @@ static Http.Invoker CheckResponseValid(Http.Invoker inner)
{
var response = await inner(request);
if (response.IsSuccessStatusCode == false)
if (!response.IsSuccessStatusCode)
throw new InvalidOperationException("Response code was not 200");
if (response.Headers.Contains("X-Consul-Index") == false ||
if (!response.Headers.Contains("X-Consul-Index") ||
response.Headers.GetValues("X-Consul-Index").Count() != 1)
throw new InvalidOperationException("Missing X-Consul-Index header");
Expand All @@ -119,7 +119,7 @@ Http.Invoker Invoker()
async Task Run()
{
var idx = 0;
while (_dispose.IsCancellationRequested == false)
while (!_dispose.IsCancellationRequested)
{
try
{
Expand All @@ -140,7 +140,7 @@ async Task Run()

public async Task Stop()
{
if (_dispose.IsCancellationRequested == false)
if (!_dispose.IsCancellationRequested)
_dispose.Cancel();
await _loop;
_client.Dispose();
Expand Down
2 changes: 1 addition & 1 deletion src/ConsulStructure/Structure.LambdaStructureWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void ApplyConfiguration(IEnumerable<KeyValuePair<string, byte[]>> keyValuePairs)
.ToList());
}

public Task Dispose()
public Task Stop()
{
return _watcherDisposer();
}
Expand Down
2 changes: 1 addition & 1 deletion src/ConsulStructure/Structure.StructureWatcher.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void ApplyConfiguration(IEnumerable<KeyValuePair<string, byte[]>> keyValuePairs)
_options.Events.KeyValuesAssigned(assigned);
}

public Task Dispose()
public Task Close()
{
return _watcherDisposer();
}
Expand Down
4 changes: 2 additions & 2 deletions src/ConsulStructure/Structure.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ internal partial class Structure
{
options = options ?? new Options();

return new Structure(new LambdaStructureWatcher(instance, options).Dispose);
return new Structure(new LambdaStructureWatcher(instance, options).Stop);
}

internal static Structure Start<T>(T instance, Options options = null)
{
options = options ?? new Options();

return new Structure(new StructureWatcher<T>(instance, options).Dispose);
return new Structure(new StructureWatcher<T>(instance, options).Close);
}

readonly Func<Task> _stopper;
Expand Down

0 comments on commit 9c4bb05

Please sign in to comment.