File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed
src/NTorSpectator.Observer Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 6
6
using NTorSpectator . Observer . TorIntegration ;
7
7
using NTorSpectator . Services ;
8
8
using Prometheus ;
9
+ using Quartz ;
9
10
using Refit ;
10
11
using Serilog ;
11
12
using Serilog . Formatting . Compact ;
39
40
. AddBizLogic ( )
40
41
. AddDatabase ( builder . Configuration )
41
42
. AddTransient < TorControlManager > ( )
42
- . AddHostedService < Spectator > ( ) ;
43
+ . AddTransient < SpectatorJob > ( )
44
+ . AddHostedService < SitesUpdater > ( ) ;
45
+
46
+ builder . Services . AddQuartz ( cfg =>
47
+ {
48
+ cfg . UseMicrosoftDependencyInjectionJobFactory ( ) ;
49
+
50
+ var jobDetail = JobBuilder . Create < SpectatorJob > ( )
51
+ . WithDescription ( "Tor spectator job" )
52
+ . WithIdentity ( "tor-spectator" )
53
+ . Build ( ) ;
54
+ cfg . AddJob < SpectatorJob > ( jobKey : jobDetail . Key , configure : j => { } ) ;
55
+ cfg . AddTrigger ( t => t . WithCronSchedule ( "0 0 * * * ?" ) . ForJob ( jobDetail ) ) ;
56
+ } ) ;
57
+ builder . Services . AddQuartzServer ( cfg => cfg . WaitForJobsToComplete = false ) ;
43
58
44
59
builder . Services
45
60
. AddRefitClient < IMastodonClient > ( sp =>
You can’t perform that action at this time.
0 commit comments