本地启动项目,直接跳过同步任务,不影响线上任务,否则会重复
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-04-10 14:24:56 +08:00
parent 6c1c46601c
commit 6633e26175
4 changed files with 23 additions and 2 deletions
@@ -9,6 +9,7 @@ using Microsoft.Extensions.Logging;
using Microsoft.Extensions.Options;
using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using System.Threading.Tasks;
@@ -27,7 +28,13 @@ public class SyncFileRecoveryService(IServiceScopeFactory _scopeFactory, FileSyn
/// <returns></returns>
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
using var scope = _scopeFactory.CreateScope();
//在本地调试的时候,不干涉部署同步任务
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
{
return;
}
using var scope = _scopeFactory.CreateScope();
var fileUploadRecordRepository = scope.ServiceProvider.GetRequiredService<IRepository<FileUploadRecord>>();
// 延迟启动,保证主机快速启动