using AipGateway.AIP; using AipGateway.API.Application.Interfaces.Services; using AipGateway.API.Domain.Models.App; using AipGateway.API.Domain.Models.Response; using AipGateway.API.Services; using AipGateway.API.Services.Interfaces; using Coravel.Invocable; using System.Diagnostics; namespace AipGateway.API.Scheduler { public class AuthKeyLoadingInvocable : IInvocable { private readonly ILogger _log; private readonly IApiAuthService _apiAuthService; public AuthKeyLoadingInvocable(ILogger log, IApiAuthService apiAuthService) { _log = log; _apiAuthService = apiAuthService; } public Task Invoke() { Stopwatch sw = Stopwatch.StartNew(); sw.Start(); _log.LogInformation("*** AuthKeyLoadingInvocable Schedule Job Start."); try { //var task = Task.Run(() => //{ _apiAuthService.LoadAuthInformation(); //}); //await task; } catch (Exception e) { _log.LogError($"*** AuthKeyLoadingInvocable.LoadLinkedApiKeys Exception: {e}"); } sw.Stop(); _log.LogInformation("*** AuthKeyLoadingInvocable Schedule Job ..End. {0,6} ms.", sw.ElapsedMilliseconds.ToString("#,##0")); return Task.CompletedTask; } } }