Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 5ff7d0f

Browse files
committed
bug fix
1 parent 5ad3623 commit 5ff7d0f

File tree

2 files changed

+6
-8
lines changed

2 files changed

+6
-8
lines changed

.env.example

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ HOMA_ASSIGN_ENDPOINT=https://homa.snapgenshin.com
2626
HOMA_USERNAME=homa
2727
HOMA_PASSWORD=homa
2828

29-
REDIS_HOST=127.0.0.1
30-
3129
# Apitally
3230
APITALLY_CLIENT_ID=YourClientID
3331

routers/patch_next.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def fetch_snap_hutao_github_latest_version() -> PatchMeta:
6969
return github_path_meta
7070

7171

72-
async def update_snap_hutao_latest_version(redis_client) -> dict:
72+
async def update_snap_hutao_latest_version(redis_client: redis.client.Redis) -> dict:
7373
"""
7474
Update Snap Hutao latest version from GitHub and Jihulab
7575
:return: dict of latest version metadata
@@ -118,7 +118,7 @@ async def update_snap_hutao_latest_version(redis_client) -> dict:
118118

119119
# Clear mirror URL if the version is updated
120120
try:
121-
redis_cached_version = redis_client.get("snap-hutao:version")
121+
redis_cached_version = await redis_client.get("snap-hutao:version")
122122
if redis_cached_version != github_patch_meta.version:
123123
# Re-initial the mirror list with empty data
124124
logger.info(
@@ -146,7 +146,7 @@ async def update_snap_hutao_latest_version(redis_client) -> dict:
146146
return return_data
147147

148148

149-
async def update_snap_hutao_deployment_version(redis_client) -> dict:
149+
async def update_snap_hutao_deployment_version(redis_client: redis.client.Redis) -> dict:
150150
"""
151151
Update Snap Hutao Deployment latest version from GitHub and Jihulab
152152
:return: dict of Snap Hutao Deployment latest version metadata
@@ -179,14 +179,14 @@ async def update_snap_hutao_deployment_version(redis_client) -> dict:
179179
mirrors=[MirrorMeta(url=cn_urls[0], mirror_name="JiHuLAB", mirror_type="direct")]
180180
)
181181

182-
current_cached_version = redis_client.get("snap-hutao-deployment:version")
182+
current_cached_version = await redis_client.get("snap-hutao-deployment:version")
183183
if current_cached_version != jihulab_meta["tag_name"]:
184184
logger.info(
185185
f"Found unmatched version, clearing mirrors. Setting Snap Hutao Deployment latest version to Redis: {await redis_client.set('snap-hutao-deployment:version', jihulab_patch_meta.version)}")
186186
logger.info(
187-
f"Reinitializing mirrors for Snap Hutao Deployment: {await redis_client.set(f'snap-hutao-deployment:mirrors:{await jihulab_patch_meta.version}', json.dumps([]))}")
187+
f"Reinitializing mirrors for Snap Hutao Deployment: {await redis_client.set(f'snap-hutao-deployment:mirrors:{jihulab_patch_meta.version}', json.dumps([]))}")
188188
else:
189-
current_mirrors = json.loads(redis_client.get(f"snap-hutao-deployment:mirrors:{jihulab_patch_meta.version}"))
189+
current_mirrors = json.loads(await redis_client.get(f"snap-hutao-deployment:mirrors:{jihulab_patch_meta.version}"))
190190
for m in current_mirrors:
191191
this_mirror = MirrorMeta(**m)
192192
jihulab_patch_meta.mirrors.append(this_mirror)

0 commit comments

Comments
 (0)