123456789101112131415161718192021222324252627282930313233343536 |
- using Coravel.Invocable;
- using System.Diagnostics;
- namespace AipDatabase.API.Scheduler
- {
- public class AipDatabaseSchedulerInvocable : IInvocable
- {
- private readonly ILogger<AipDatabaseSchedulerInvocable> _log;
- public AipDatabaseSchedulerInvocable(ILogger<AipDatabaseSchedulerInvocable> log)
- {
- _log = log;
- }
- public async Task Invoke()
- {
- Stopwatch sw = Stopwatch.StartNew();
- sw.Start();
- _log.LogInformation("*** AipDatabaseScheduler Schedule Job Start.");
- try
- {
- var task = Task.Run(() =>
- {
- Thread.Sleep(1000);
- });
- await task;
- }
- catch (Exception e)
- {
- _log.LogError($"*** AipDatabaseScheduler Schedule Job .Error. Exception: {e}");
- }
- sw.Stop();
- _log.LogInformation("*** AipDatabaseScheduler Schedule Job ..End. {0} ms.", sw.ElapsedMilliseconds);
- }
- }
- }
|