Issue #296: MtApi5 - Added property CommandTimeout to define time for waiting result of response from MetaTrader. Default value 30 sec

This commit is contained in:
Viacheslav Demydiuk
2026-04-06 20:22:10 +03:00
parent 249b0f9fbb
commit fa1e6b6c62
4 changed files with 44 additions and 3 deletions
+2 -2
View File
@@ -65,7 +65,7 @@ namespace MtClient
logger_.Debug($"MtRpcClient.Disconnect: success");
}
public string? SendCommand(int expertHandle, int commandType, string payload)
public string? SendCommand(int expertHandle, int commandType, string payload, int timeout = 10000) // 10 sec
{
CommandTask<string> commandTask = new();
int commandId;
@@ -78,7 +78,7 @@ namespace MtClient
MtCommand command = new(expertHandle, commandType, commandId, payload);
Send(command);
var response = commandTask.WaitResponse(10000); // 10 sec
var response = commandTask.WaitResponse(timeout);
lock (tasks_)
{
tasks_.Remove(commandId);