添加ConfigureAwait

This commit is contained in:
Kimdiego2098
2023-10-26 18:06:33 +08:00
parent f67a638565
commit 0ff94eec1b
3 changed files with 10 additions and 10 deletions

View File

@@ -518,7 +518,7 @@ public class OPCUAClient : IDisposable
/// </summary>
public async Task ConnectAsync()
{
await ConnectAsync(OPCNode.OPCUrl);
await ConnectAsync(OPCNode.OPCUrl).ConfigureAwait(false);
}
/// <summary>
@@ -560,7 +560,7 @@ public class OPCUAClient : IDisposable
userIdentity = new UserIdentity(new AnonymousIdentityToken());
}
//创建本地证书
await m_application.CheckApplicationInstanceCertificate(true, 0, 1200);
await m_application.CheckApplicationInstanceCertificate(true, 0, 1200).ConfigureAwait(false);
m_session = await Opc.Ua.Client.Session.Create(
m_configuration,
endpoint,
@@ -569,7 +569,7 @@ public class OPCUAClient : IDisposable
(string.IsNullOrEmpty(OPCUAName)) ? m_configuration.ApplicationName : OPCUAName,
60000,
userIdentity,
Array.Empty<string>());
Array.Empty<string>()).ConfigureAwait(false);
typeSystem = new ComplexTypeSystem(m_session);
m_session.KeepAliveInterval = OPCNode.KeepAliveInterval == 0 ? 60000 : OPCNode.KeepAliveInterval;

View File

@@ -181,11 +181,11 @@ public class CollectDeviceThread : IAsyncDisposable
device.IsShareChannel = CollectDeviceCores.Count > 1;
if (channelResult.IsSuccess)
{
await device.BeforeActionAsync(stoppingToken, channelResult.Content);
await device.BeforeActionAsync(stoppingToken, channelResult.Content).ConfigureAwait(false);
}
else
{
await device.BeforeActionAsync(stoppingToken);
await device.BeforeActionAsync(stoppingToken).ConfigureAwait(false);
}
}
@@ -203,7 +203,7 @@ public class CollectDeviceThread : IAsyncDisposable
//如果是共享通道类型,需要每次转换时切换适配器
if (device.IsShareChannel) device.Driver.InitDataAdapter();
var result = await device.RunActionAsync(stoppingToken);
var result = await device.RunActionAsync(stoppingToken).ConfigureAwait(false);
if (result == ThreadRunReturn.None)
{
await Task.Delay(CycleInterval);
@@ -243,7 +243,7 @@ public class CollectDeviceThread : IAsyncDisposable
{
//如果插件还没释放,执行一次结束函数
if (!device.Driver.DisposedValue)
await device.FinishActionAsync();
await device.FinishActionAsync().ConfigureAwait(false);
}
}

View File

@@ -165,7 +165,7 @@ public class UploadDeviceThread : IAsyncDisposable
//添加通道报文到每个设备
var data = new EasyLogger(device.Driver.NewMessage) { LogLevel = ThingsGateway.Foundation.Core.LogLevel.Trace };
log.AddLogger(data);
await device.BeforeActionAsync(stoppingToken);
await device.BeforeActionAsync(stoppingToken).ConfigureAwait(false);
}
while (!stoppingToken.IsCancellationRequested)
@@ -180,7 +180,7 @@ public class UploadDeviceThread : IAsyncDisposable
if (device.IsInitSuccess)
{
var result = await device.RunActionAsync(stoppingToken);
var result = await device.RunActionAsync(stoppingToken).ConfigureAwait(false);
if (result == ThreadRunReturn.None)
{
await Task.Delay(CycleInterval);
@@ -221,7 +221,7 @@ public class UploadDeviceThread : IAsyncDisposable
{
//如果插件还没释放,执行一次结束函数
if (!device.Driver.DisposedValue)
await device.FinishActionAsync();
await device.FinishActionAsync().ConfigureAwait(false);
}
}