ShokoAnime / ShokoServer

Repository for Shoko Server.
http://shokoanime.com/shoko-server/
MIT License
386 stars 75 forks source link

Quartz.NET and ConnectivityMonitor basics #1015

Closed TheBinaryLoop closed 1 year ago

TheBinaryLoop commented 1 year ago
da3dsoul commented 1 year ago

It looked like you were still working on stuff here. Let me know when you want me to look and possibly merge.

The only changes I'd like done from the last time I looked is to move the ImportFolderID to a property to be auto-filled (and in any other jobs added after the comment) and to use GetRequiredService<T>() in places where the dependency is not optional (always from what I see).

TheBinaryLoop commented 1 year ago

Yeah, still working on it. Didn't have time the last few days but will continue to work on at as soon as I find some free time 🙂

TheBinaryLoop commented 1 year ago

If you have any idea how to name the jobs better in the JobKey(Key and group) pls let me know

da3dsoul commented 1 year ago

And no worries. I just didn't want to merge it before you were done or have you waiting on me because I didn't know you were

TheBinaryLoop commented 1 year ago

The only changes I'd like done from the last time I looked is to move the ImportFolderID to a property to be auto-filled (and in any other jobs added after the comment)

@da3dsoul If you explain to me / give me an example how to do that, I'm going to implement that tomorrow.

da3dsoul commented 1 year ago

See here: https://github.com/ShokoAnime/ShokoServer/pull/1015#discussion_r1020846086

da3dsoul commented 1 year ago

Quartz.Extensions.JobBuilderFactory is officially up in nuget. It has a helper for generating JobKeys in it. I'll comment on some things to show how it's used

da3dsoul commented 1 year ago

Much better. Fixed up the git tree

da3dsoul commented 1 year ago

@TheBinaryLoop I'm going to merge this. The quartz branch will stay separate for now, so you can keep working on it if you want and have time. I just made a bunch of refactors that will make this harder for you to fix, so I'm merging and fixing it myself

da3dsoul commented 1 year ago

In the DI registration, is there a reason you used factory registration (AddSingleton<IConnectivityMonitor>(_ => new GeneralConnectivityMonitor())) for the GeneralConnectivityMonitor, instead of services.AddSingleton<IConnectivityMonitor,GeneralConnectivityMonitor>();?