From 7c33b3f334cf91918add7af08866f2ea37ed9c3f Mon Sep 17 00:00:00 2001 From: Melodi <62381002+Melodi17@users.noreply.github.com> Date: Thu, 3 Sep 2026 23:06:05 +1000 Subject: chore: initial commit --- .../Services/VersionControlSyncService.cs | 50 ++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 src/marlin.web/Services/VersionControlSyncService.cs (limited to 'src/marlin.web/Services/VersionControlSyncService.cs') diff --git a/src/marlin.web/Services/VersionControlSyncService.cs b/src/marlin.web/Services/VersionControlSyncService.cs new file mode 100644 index 0000000..ba40662 --- /dev/null +++ b/src/marlin.web/Services/VersionControlSyncService.cs @@ -0,0 +1,50 @@ +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) + { + + } + } +} \ No newline at end of file -- cgit v1.3.1