mirror of
https://github.com/immense/Remotely.git
synced 2025-10-26 11:27:15 +00:00
* Convert server to new single-file startup model. * Add remote control implementations. * Implement IViewerAuthorizer. * Update hub endpoints. * Implement HubEventHandler. * Implement ViewerHubDataProvider. * Implement page data provider. * Implement RCL and refactor. * Update submodule. * Replace submodule with NuGet. * Update copy URL. * Update NuGet. * Remove deprecated WebRTC. * Remove deprecated WebRTC. * Update Immense.RemoteControl * Building out desktop projects. * Bring more services into submodule. * Update submodule. * Update submodule. * Refactoring for module. * Update submodule. * Update submodule * Got Windows desktop app running. * Refactor for submodule changes. * FIx unattended session start. * Switch desktop app out of console mode. * Fix tests. * Update publishing. * Remove ClickOnce middleware. * Remove ClickOnce remnants. * Update submodule * Add some logging. * Update Linux path. * Update submodule. * Add cleanup service for unattended sessions that failed to start. * Update submodule. * Fix chat. * Add ValidateExecutableReferencesMatchSelfContained property. * Add other submodule projects. Align checkbox. * Update submodule. Reduce deserialization in the browser, resulting in faster renders. * Update submodule. * Update submodule. * Update submodule. * Update submodule. * Add orgId back for branding. * Get branding loading in desktop apps. * Update submodule. * Create log dir. * Refactor version check on config page. * Update submodule. * Update submodule. * Change submodule URL. * Correct namespace. * Update submodule. * Checkout submodules recursively.
49 lines
1.4 KiB
C#
49 lines
1.4 KiB
C#
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Hosting;
|
|
using System;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Remotely.Server.Services
|
|
{
|
|
public class DbCleanupService : IHostedService, IDisposable
|
|
{
|
|
public DbCleanupService(IServiceProvider serviceProvider)
|
|
{
|
|
Services = serviceProvider;
|
|
}
|
|
|
|
private IServiceProvider Services { get; }
|
|
private System.Timers.Timer CleanupTimer { get; set; }
|
|
|
|
public void Dispose()
|
|
{
|
|
CleanupTimer?.Dispose();
|
|
GC.SuppressFinalize(this);
|
|
}
|
|
|
|
public Task StartAsync(CancellationToken cancellationToken)
|
|
{
|
|
CleanupTimer?.Dispose();
|
|
CleanupTimer = new System.Timers.Timer(TimeSpan.FromDays(1).TotalMilliseconds);
|
|
CleanupTimer.Elapsed += CleanupTimer_Elapsed;
|
|
CleanupTimer.Start();
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
public Task StopAsync(CancellationToken cancellationToken)
|
|
{
|
|
CleanupTimer?.Dispose();
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
private void CleanupTimer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
|
|
{
|
|
using var scope = Services.CreateScope();
|
|
var dataService = scope.ServiceProvider.GetRequiredService<IDataService>();
|
|
|
|
dataService.CleanupOldRecords();
|
|
}
|
|
}
|
|
}
|