Merged PR 98: add lock for kusto endpoint CommandAsync as ingest control commands are limited by ingest cluster capacity

add lock for kusto endpoint CommandAsync as ingest control commands are limited by ingest cluster capacity
https://learn.microsoft.com/en-us/azure/data-explorer/kusto/management/capacity-policy#management-commands-throttling

seen throttled exception in ingest command for kusto emulator

"code": "Too many requests",
"message": "Request is denied due to throttling. "
"@type": "Kusto.DataNode. Exceptions.ControlCommandThrottledException
This commit is contained in:
Jason Gilbertson 2024-07-24 21:29:42 +00:00
Родитель 562c692f14 200b580008
Коммит 007d149798
1 изменённых файлов: 7 добавлений и 3 удалений

Просмотреть файл

@ -43,6 +43,7 @@ namespace CollectSFData.Kusto
private Timer _adminIngestTimer { get; set; }
private Timer _adminTimer { get; set; }
private Timer _queryTimer { get; set; }
private object _lockObj = new object();
public KustoEndpoint(ConfigurationOptions config)
{
@ -162,9 +163,12 @@ namespace CollectSFData.Kusto
Log.Info($"command:{command}", ConsoleColor.Blue);
return await _kustoTasks.TaskFunction((responseList) =>
{
ICslAdminProvider adminClient = CreateAdminClient();
List<string> results = EnumerateResultsCsv(adminClient.ExecuteControlCommand(command));
return results;
// ingest commands are limited by cluster ingest capacity
lock (_lockObj)
{
ICslAdminProvider adminClient = CreateAdminClient();
return EnumerateResultsCsv(adminClient.ExecuteControlCommand(command));
}
}) as List<string>;
}