feat: replace Hangfire with Coravel
This commit is contained in:
parent
ef221b2c45
commit
0aadc5fb47
19 changed files with 305 additions and 309 deletions
|
@ -1,18 +1,15 @@
|
|||
using Coravel;
|
||||
using Foxnouns.Backend;
|
||||
using Foxnouns.Backend.Database;
|
||||
using Serilog;
|
||||
using Foxnouns.Backend.Extensions;
|
||||
using Foxnouns.Backend.Middleware;
|
||||
using Foxnouns.Backend.Services;
|
||||
using Foxnouns.Backend.Utils;
|
||||
using Hangfire;
|
||||
using Hangfire.Redis.StackExchange;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Minio;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using Sentry.Extensibility;
|
||||
using Sentry.Hangfire;
|
||||
|
||||
// Read version information from .version in the repository root
|
||||
await BuildInfo.ReadBuildInfo();
|
||||
|
@ -64,6 +61,7 @@ JsonConvert.DefaultSettings = () => new JsonSerializerSettings
|
|||
};
|
||||
|
||||
builder.Services
|
||||
.AddQueue()
|
||||
.AddDbContext<DatabaseContext>()
|
||||
.AddCustomServices()
|
||||
.AddCustomMiddleware()
|
||||
|
@ -74,12 +72,6 @@ builder.Services
|
|||
.WithCredentials(config.Storage.AccessKey, config.Storage.SecretKey)
|
||||
.Build());
|
||||
|
||||
builder.Services.AddHangfire(c => c.UseSentry().UseRedisStorage(config.Jobs.Redis, new RedisStorageOptions
|
||||
{
|
||||
Prefix = "foxnouns_"
|
||||
}))
|
||||
.AddHangfireServer(options => { options.WorkerCount = config.Jobs.Workers; });
|
||||
|
||||
var app = builder.Build();
|
||||
|
||||
await app.Initialize(args);
|
||||
|
@ -95,12 +87,6 @@ app.UseCors();
|
|||
app.UseCustomMiddleware();
|
||||
app.MapControllers();
|
||||
|
||||
app.UseHangfireDashboard("/hangfire", new DashboardOptions
|
||||
{
|
||||
AppPath = null,
|
||||
AsyncAuthorization = [new HangfireDashboardAuthorizationFilter(app.Services)]
|
||||
});
|
||||
|
||||
app.Urls.Clear();
|
||||
app.Urls.Add(config.Address);
|
||||
if (config.MetricsAddress != null) app.Urls.Add(config.MetricsAddress);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue