Skip to content

Commit

Permalink
[Destiny] Ignore files that aren't json manifest files.
Browse files Browse the repository at this point in the history
- Don't load config's settings file into the manifest.
- Fix manifest cache not loading on enable and always loading on lazy.
  • Loading branch information
TrustyJAID committed Jan 11, 2025
1 parent 143bdc9 commit 1ca2b35
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions destiny/destiny.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,18 +121,23 @@ async def cog_unload(self):
async def load_cache(self):
tokens = await self.bot.get_shared_api_tokens("bungie")
self.api = DestinyAPI(self, **tokens)
if await self.config.cache_manifest() > 1:
if await self.config.cache_manifest() < 2:
self._ready.set()
return
loop = asyncio.get_running_loop()
for file in cog_data_path(self).iterdir():
if not file.is_file():
if (
not file.is_file()
or not file.name.endswith(".json")
or file.name.startswith("settings")
):
# ignore config's settings file and
continue
task = functools.partial(self.api.load_file, file=file)
name = file.name.replace(".json", "")
try:
self.api._manifest[name] = await asyncio.wait_for(
loop.run_in_executor(None, task), timeout=60
loop.run_in_executor(None, task), timeout=180
)
except asyncio.TimeoutError:
log.info("Error loading manifest data")
Expand Down

0 comments on commit 1ca2b35

Please sign in to comment.