Fix async/await warnings

This commit is contained in:
Philip Wood
2018-03-06 10:59:01 +00:00
parent db05935b89
commit b8e95373a4
21 changed files with 60 additions and 85 deletions

View File

@ -18,7 +18,7 @@ namespace Ocelot.Configuration.Repository
_configFilePath = $"{AppContext.BaseDirectory}/configuration{(string.IsNullOrEmpty(hostingEnvironment.EnvironmentName) ? string.Empty : ".")}{hostingEnvironment.EnvironmentName}.json";
}
public async Task<Response<FileConfiguration>> Get()
public Task<Response<FileConfiguration>> Get()
{
string jsonConfiguration;
@ -29,10 +29,10 @@ namespace Ocelot.Configuration.Repository
var fileConfiguration = JsonConvert.DeserializeObject<FileConfiguration>(jsonConfiguration);
return new OkResponse<FileConfiguration>(fileConfiguration);
return Task.FromResult<Response<FileConfiguration>>(new OkResponse<FileConfiguration>(fileConfiguration));
}
public async Task<Response> Set(FileConfiguration fileConfiguration)
public Task<Response> Set(FileConfiguration fileConfiguration)
{
string jsonConfiguration = JsonConvert.SerializeObject(fileConfiguration);
@ -45,8 +45,8 @@ namespace Ocelot.Configuration.Repository
System.IO.File.WriteAllText(_configFilePath, jsonConfiguration);
}
return new OkResponse();
return Task.FromResult<Response>(new OkResponse());
}
}
}
}

View File

@ -12,19 +12,19 @@ namespace Ocelot.Configuration.Repository
private IOcelotConfiguration _ocelotConfiguration;
public async Task<Response<IOcelotConfiguration>> Get()
public Task<Response<IOcelotConfiguration>> Get()
{
return new OkResponse<IOcelotConfiguration>(_ocelotConfiguration);
return Task.FromResult<Response<IOcelotConfiguration>>(new OkResponse<IOcelotConfiguration>(_ocelotConfiguration));
}
public async Task<Response> AddOrReplace(IOcelotConfiguration ocelotConfiguration)
public Task<Response> AddOrReplace(IOcelotConfiguration ocelotConfiguration)
{
lock (LockObject)
{
_ocelotConfiguration = ocelotConfiguration;
}
return new OkResponse();
return Task.FromResult<Response>(new OkResponse());
}
}
}
}

View File

@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Collections.Generic;
using System.Threading.Tasks;
using Ocelot.Values;
@ -14,16 +13,16 @@ namespace Ocelot.ServiceDiscovery
_configuration = configuration;
}
public async Task<List<Service>> Get()
public Task<List<Service>> Get()
{
return new List<Service>
return Task.FromResult(new List<Service>
{
new Service(_configuration.ServiceName,
new ServiceHostAndPort(_configuration.HostName, _configuration.Port),
"doesnt matter with service fabric",
"doesnt matter with service fabric",
new List<string>())
};
});
}
}
}