namespace marlin.web.Services; using System.Diagnostics; using System.Text; using core.functional; using core.models; using Data; using Microsoft.EntityFrameworkCore; public class VersionControlSyncService : BackgroundService { private readonly ILogger _logger; private readonly IServiceProvider _services; private ICollection _sources; private Dictionary _nextPoll; public VersionControlSyncService(ILogger logger, IServiceProvider services) { this._logger = logger; this._services = services; this._sources = new List(); this._nextPoll = new(); } public async Task FetchSources() { await using var scoped = this._services.CreateAsyncScope(); var dbContext = scoped.ServiceProvider.GetRequiredService(); this._sources = await dbContext.Sources.ToListAsync(); } private async Task SyncSource(VersionControlSource source, ApplicationDbContext db) { IGitClient client = new GitBinaryClient(); var refs = await client.GetRemoteRefs(source.UpstreamUrl); } protected override async Task ExecuteAsync(CancellationToken stoppingToken) { await this.FetchSources(); while (!stoppingToken.IsCancellationRequested) { } } }