1234567891011121314151617181920212223242526272829303132333435 |
- using System;
- using System.Collections.Generic;
- using System.Threading;
- using System.Threading.Tasks;
- using System.Linq;
- using Microsoft.Extensions.Hosting;
- using MySystem;
- using MySystem.PxcModels;
- using Library;
- using LitJson;
- public class SycnSpTimer : BackgroundService
- {
- protected override async Task ExecuteAsync(CancellationToken stoppingToken)
- {
- while (!stoppingToken.IsCancellationRequested)
- {
- int timespan = 100;
- await Task.Delay(timespan).ContinueWith(tsk =>
- {
- DoWorks();
- });
- }
- }
- private void DoWorks()
- {
- string MsgContent = RedisDbconn.Instance.RPop<string>("SycnSpServer");
- if (!string.IsNullOrEmpty(MsgContent))
- {
- JobMqMsg job = Newtonsoft.Json.JsonConvert.DeserializeObject<JobMqMsg>(MsgContent);
- SycnSpService.Instance.Start(job);
- }
- }
- }
|