Newer
Older
VQCalendarAttention / VQCalendarAttention / Services / CalendarAttentionService.cs
@Syuji Syuji on 15 Apr 2023 901 bytes 最初のコミット
using System;
using Cronos;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using ServiceWorkerCronJobDemo.Services;

namespace VestalisQuintet.VQCalendarAttention
{
    public class CalendarAttentionService : CronJobService
    {
        private readonly IServiceProvider _serviceProvider;

        public CalendarAttentionService(CronExpression expression, TimeZoneInfo timeZoneInfo, IServiceProvider serviceProvider)
            : base(expression, timeZoneInfo)
        {
            _serviceProvider = serviceProvider;
        }

        public override async Task DoWork(CancellationToken cancellationToken)
        {
            // ここにCronジョブで実行する処理を実装します。
            Console.WriteLine("Cron job executed at: " + DateTimeOffset.Now);

            await Task.CompletedTask;
        }
    }
}