♻️ Better delivery service for AP

This commit is contained in:
2026-01-01 01:20:44 +08:00
parent c59fc011f4
commit 14d5254461
13 changed files with 3091 additions and 139 deletions

View File

@@ -1,3 +1,4 @@
using DysonNetwork.Sphere.ActivityPub;
using DysonNetwork.Sphere.Post;
using DysonNetwork.Sphere.Publisher;
using DysonNetwork.Sphere.WebReader;
@@ -39,6 +40,22 @@ public static class ScheduledJobsConfiguration
.WithIdentity("PublisherSettlementTrigger")
.WithCronSchedule("0 0 0 * * ?")
);
q.AddJob<ActivityPubDeliveryRetryJob>(opts => opts.WithIdentity("ActivityPubDeliveryRetry"));
q.AddTrigger(opts => opts
.ForJob("ActivityPubDeliveryRetry")
.WithIdentity("ActivityPubDeliveryRetryTrigger")
.WithSimpleSchedule(o => o
.WithIntervalInMinutes(1)
.RepeatForever())
);
q.AddJob<ActivityPubDeliveryCleanupJob>(opts => opts.WithIdentity("ActivityPubDeliveryCleanup"));
q.AddTrigger(opts => opts
.ForJob("ActivityPubDeliveryCleanup")
.WithIdentity("ActivityPubDeliveryCleanupTrigger")
.WithCronSchedule("0 0 3 * * ?")
);
});
services.AddQuartzHostedService(q => q.WaitForJobsToComplete = true);

View File

@@ -65,6 +65,7 @@ public static class ServiceCollectionExtensions
});
services.AddHostedService<BroadcastEventHandler>();
services.AddHostedService<ActivityPubDeliveryWorker>();
return services;
}
@@ -89,6 +90,7 @@ public static class ServiceCollectionExtensions
)
{
services.Configure<GeoOptions>(configuration.GetSection("GeoIP"));
services.Configure<ActivityPubDeliveryOptions>(configuration.GetSection("ActivityPubDelivery"));
services.AddScoped<GeoService>();
services.AddScoped<PublisherService>();
services.AddScoped<PublisherSubscriptionService>();
@@ -108,6 +110,7 @@ public static class ServiceCollectionExtensions
services.AddScoped<ActivityPubActivityHandler>();
services.AddScoped<ActivityPubDeliveryService>();
services.AddScoped<ActivityPubDiscoveryService>();
services.AddSingleton<ActivityPubQueueService>();
services.AddScoped<ActivityPubFollowController>();
services.AddScoped<ActivityPubController>();