Skip to content

Commit

Permalink
fix: Increase mimo task delay
Browse files Browse the repository at this point in the history
  • Loading branch information
seriaati committed Jan 31, 2025
1 parent d1c62c4 commit d39ea55
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions hoyo_buddy/hoyo/clients/gpy.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,9 @@
load_dotenv()
env = os.environ["ENV"]

MIMO_TASK_DELAY = 1.0
MIMO_COMMUNITY_TASK_DELAY = 2.0

MAX_RETRIES = len(PROXY_APIS)
BACKOFF_FACTOR = 2
MAX_BACKOFF = 32
Expand Down Expand Up @@ -958,7 +961,7 @@ async def finish_and_claim_mimo_tasks(
await self.finish_mimo_task(
task.id, game_id=game_id, version_id=version_id, api_name=api_name
)
await asyncio.sleep(0.5)
await asyncio.sleep(MIMO_TASK_DELAY)
except genshin.GenshinException as e:
if e.retcode == -500001: # Invalid fields in calculation
continue
Expand All @@ -976,17 +979,17 @@ async def finish_and_claim_mimo_tasks(
reply_id = await self.reply_to_post(
random.choice(POST_REPLIES), post_id=int(post_id)
)
await asyncio.sleep(2)
await asyncio.sleep(MIMO_COMMUNITY_TASK_DELAY)
await self.delete_reply(reply_id=reply_id, post_id=int(post_id))
await asyncio.sleep(2)
await asyncio.sleep(MIMO_COMMUNITY_TASK_DELAY)
finished = True

topic_id: str | None = args.get("topic_id")
if topic_id is not None:
await self.join_topic(int(topic_id))
await asyncio.sleep(2)
await asyncio.sleep(MIMO_COMMUNITY_TASK_DELAY)
await self.leave_topic(int(topic_id))
await asyncio.sleep(2)
await asyncio.sleep(MIMO_COMMUNITY_TASK_DELAY)
finished = True

if finished:
Expand All @@ -1000,7 +1003,7 @@ async def finish_and_claim_mimo_tasks(
await self.claim_mimo_task_reward(
task.id, game_id=game_id, version_id=version_id, api_name=api_name
)
await asyncio.sleep(0.5)
await asyncio.sleep(MIMO_TASK_DELAY)
except genshin.GenshinException as e:
if e.retcode == -500001: # Invalid fields in calculation
continue
Expand Down

0 comments on commit d39ea55

Please sign in to comment.