Skip to content

Commit

Permalink
fix: various fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MagicTheDev committed Apr 25, 2024
1 parent 65364e0 commit c64cdf0
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions gamewide/war/track.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ async def fetch(url, session: aiohttp.ClientSession, headers, tag, throttler: Th
return (None, None)

bot_clan_tags = await db_client.clans_db.distinct("tag")
size_break = 25_000
size_break = 60_000

if x % 30 != 0:
right_now = datetime.now().timestamp()
Expand Down Expand Up @@ -150,10 +150,11 @@ async def fetch(url, session: aiohttp.ClientSession, headers, tag, throttler: Th
if war_unique_id not in timers_alr_captured:
for member in war.clan.members + war.opponent.members:
war_timers.append(UpdateOne({"_id" : member.tag}, {"$set" : {"clans" : [war.clan.tag, war.opponent.tag], "time" : war_end.time}}, upsert=True))
changes.append(InsertOne({"war_id" : war_unique_id,
"clans" : [tag, opponent_tag],
"endTime" : int(war_end.time.replace(tzinfo=pend.UTC).timestamp())
}))

changes.append(InsertOne({"war_id" : war_unique_id,
"clans" : [tag, opponent_tag],
"endTime" : int(war_end.time.replace(tzinfo=pend.UTC).timestamp())
}))
#schedule getting war
try:
scheduler.add_job(store_war, 'date', run_date=run_time, args=[tag, opponent_tag, int(war_prep.timestamp())],
Expand All @@ -173,6 +174,8 @@ async def fetch(url, session: aiohttp.ClientSession, headers, tag, throttler: Th
except Exception:
pass

await asyncio.sleep(5)

if ones_that_tried_again:
logger.info(f"{len(ones_that_tried_again)} tried again, examples: {ones_that_tried_again[:5]}")

Expand Down

0 comments on commit c64cdf0

Please sign in to comment.