add OCR stats

This commit is contained in:
13xforever
2020-03-08 23:14:48 +05:00
parent 75ea32fc6e
commit 62fe5d26cb
2 changed files with 22 additions and 19 deletions

View File

@@ -19,6 +19,7 @@ namespace CompatBot.EventHandlers
private static readonly ComputerVisionClient client = new ComputerVisionClient(new ApiKeyServiceClientCredentials(Config.AzureComputerVisionKey)) {Endpoint = Config.AzureComputerVisionEndpoint};
private static readonly SemaphoreSlim workSemaphore = new SemaphoreSlim(0);
private static readonly ConcurrentQueue<(MessageCreateEventArgs evt, string readOperationId)> workQueue = new ConcurrentQueue<(MessageCreateEventArgs args, string readOperationId)>();
public static int MaxQueueLength = 0;
public static async Task OnMessageCreated(MessageCreateEventArgs evt)
{
@@ -68,6 +69,7 @@ namespace CompatBot.EventHandlers
if (Config.Cts.IsCancellationRequested)
return;
MaxQueueLength = Math.Max(MaxQueueLength, workQueue.Count);
if (!workQueue.TryDequeue(out var item))
continue;