Skip to content

Commit c6397e7

Browse files
committed
Added repo hash to timer data
1 parent 587718e commit c6397e7

File tree

1 file changed

+17
-10
lines changed

1 file changed

+17
-10
lines changed

app/tasks.py

Lines changed: 17 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,8 @@ def is_recent(
416416

417417
class TimerData(BaseModelORJson):
418418
updatedAt: int
419+
hash: str | None
420+
timestamp: int | None
419421
events: list[NiceEvent]
420422
gachas: list[NiceGacha]
421423
masterMissions: list[NiceMasterMission]
@@ -426,6 +428,7 @@ class TimerData(BaseModelORJson):
426428

427429
async def dump_current_events(
428430
util: ExportUtil,
431+
repo_info: RepoInfo | None,
429432
nice_events: list[NiceEvent],
430433
raw_gacha_entities: list[GachaEntity],
431434
nice_mms: list[NiceMasterMission],
@@ -474,6 +477,8 @@ async def dump_current_events(
474477

475478
timer_data = TimerData(
476479
updatedAt=now,
480+
hash=repo_info.hash if repo_info else None,
481+
timestamp=repo_info.timestamp if repo_info else None,
477482
events=events,
478483
gachas=nice_gachas,
479484
masterMissions=masterMissions,
@@ -614,16 +619,6 @@ async def generate_exports(
614619
async with engine.connect() as conn:
615620
raw_constants = await fetch.get_everything(conn, MstConstant)
616621

617-
await dump_current_events(
618-
util,
619-
nice_events,
620-
raw_gacha_entities,
621-
nice_mms,
622-
nice_shops,
623-
nice_items,
624-
raw_constants,
625-
)
626-
627622
repo_info = await get_repo_version(redis, region)
628623
if repo_info is None:
629624
info_path = export_path / "info.json"
@@ -638,6 +633,17 @@ async def generate_exports(
638633
export_path, "info", export_info.model_dump(mode="json")
639634
)
640635

636+
await dump_current_events(
637+
util,
638+
repo_info,
639+
nice_events,
640+
raw_gacha_entities,
641+
nice_mms,
642+
nice_shops,
643+
nice_items,
644+
raw_constants,
645+
)
646+
641647
if enable_webhook:
642648
await report_webhooks(region_path, "export")
643649

@@ -673,6 +679,7 @@ async def generate_exports(
673679

674680
await dump_current_events(
675681
util_en,
682+
repo_info,
676683
nice_events_lang_en,
677684
raw_gacha_entities,
678685
nice_mms,

0 commit comments

Comments
 (0)