Skip to content

Commit

Permalink
Add handling for job types.
Browse files Browse the repository at this point in the history
  • Loading branch information
emmiegit committed Jan 29, 2024
1 parent 8609af2 commit 2d3dcee
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
18 changes: 17 additions & 1 deletion yellowstone/job/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,13 @@

from ..exception import UnknownJobError
from ..types import Json
from . import get_user, get_user_avatar, index_site_members
from . import (
get_user,
get_user_avatar,
index_forum_categories,
index_forum_threads,
index_site_members,
)
from .get_user import GetUserJob
from .get_user_avatar import GetUserAvatarJob
from .index_forum_threads import ForumThreadsJob
Expand Down Expand Up @@ -116,6 +122,16 @@ def process(self, core: "BackupDispatcher", job: JobDict) -> None:
core,
cast(index_site_members.SiteMemberJob, data),
)
case JobType.INDEX_FORUM_CATEGORIES:
index_forum_categories.run(
core,
cast(index_forum_categories.ForumCategoriesJob, data),
)
case JobType.INDEX_FORUM_THREADS:
index_forum_threads.run(
core,
cast(index_forum_threads.ForumThreadsJob, data),
)
case JobType.FETCH_USER:
get_user.run(
core,
Expand Down
2 changes: 1 addition & 1 deletion yellowstone/job/index_forum_categories.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ForumCategoryProgressRow(TypedDict):
last_post_id: Optional[int]


def run(core: "BackupDispatcher", *, data: ForumCategoriesJob) -> None:
def run(core: "BackupDispatcher", data: ForumCategoriesJob) -> None:
site_slug = data["site_slug"]

# Clear out previous forum groups
Expand Down
2 changes: 1 addition & 1 deletion yellowstone/job/index_forum_threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,6 @@ class ForumThreadsJob(TypedDict):
category_id: int


def run(core: "BackupDispatcher", *, data: ForumThreadsJob) -> None:
def run(core: "BackupDispatcher", data: ForumThreadsJob) -> None:
# TODO
pass

0 comments on commit 2d3dcee

Please sign in to comment.