Add Job System (#656)

* Add Job System

* Remove testing stuff

* changelog

* plugin work

* Convert a couple more jobs

* simplify callback

* assert

* Logging changes and rendezvous perf

* changelog

* sb segment viewed job

* clear cache, and few changes

* Lint fix

* a couple more jobs

* reduce rendezvous in web server

* refactor

* Lint fix

* no message

* test shutdown

* comment

* free fields

---------

Co-authored-by: github-action linter <githubaction@githubaction.com>
This commit is contained in:
Brahim Hadricheandgithub-action linter authored and GitHub committed 2025-06-17 20:13:48 -04:00
1 parent 45983a67af
commit d70a07049a
74 files changed
+1090 -298

No files matched your search

@@ -0,0 +1,36 @@
import "pkg:/components/Services/Invidious/InvidiousService.bs"
import "pkg:/components/Services/Invidious/InvidiousToContentNode.bs"
@job("ChannelContentJob")
function ExecuteJob() as void
input = JobGetInput()
contentNode = input.content
invidiousNode = input.invidious
if JobIsCancelled()
contentNode.loadState = FeedLoadState.None
JobCancel()
return
end if
service = new Invidious.InvidiousService(invidiousNode)
cancallation = CancellationUtils.CreateCancellation(JobGetCallbackNode(), "cancel", true)
response = service.GetChannel(contentNode.authorId, cancallation)
if JobIsCancelled()
contentNode.loadState = FeedLoadState.None
JobCancel()
return
end if
metadata = response.Json()
if not response.IsSuccess() or metadata = invalid
contentNode.loadState = FeedLoadState.Error
JobError(response.ErrorMessage())
return
end if
InvidiousContent.ToChannelContentNode(contentNode, metadata)
contentNode.loadState = FeedLoadState.Loaded
end function