Skip to content
This repository has been archived by the owner on Mar 13, 2023. It is now read-only.

Commit

Permalink
Resolve non entity names outside of KM coroutine.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nathan-LS committed Jan 21, 2022
1 parent 5d16ded commit 396c514
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions Insight/InsightSubsystems/Cron/CronManager.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ async def start_subsystem(self):
CronTasks.TicketUtilizationMetrics_Users(cron_manager=self))
await self.new_cron_task("NamesDoomheim", CronTasks.NamesDoomheim(cron_manager=self))
await self.new_cron_task("ClearTmpTables", CronTasks.ClearTmpTables(cron_manager=self))
await self.new_cron_task("ResolveNonEntityNames", CronTasks.ResolveNonEntityNames(cron_manager=self))

async def new_cron_task(self, t_name, cron_task_instance: CronTasks.AbstractCronTask):
await cron_task_instance.start_loop()
Expand Down
25 changes: 25 additions & 0 deletions Insight/InsightSubsystems/Cron/CronTasks/ResolveNonEntityNames.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
from InsightSubsystems.Cron.CronTasks.AbstractCronTask import AbstractCronTask
from database.db_tables.eve.mass_name_resolve import name_resolve

class ResolveNonEntityNames(AbstractCronTask):
def __init__(self, cron_manager):
super().__init__(cron_manager)
self.error_ids_404 = {}
self.error_ids_non404 = {}

def call_now(self) -> bool:
return False

def run_at_intervals(self) -> bool:
return False

def loop_iteration(self) -> int:
return 3600

def _resolve_names(self):
name_resolve.api_mass_name_resolve(self.service, error_ids_404=self.error_ids_404,
error_ids_non404=self.error_ids_non404, exclude_nonentity=False,
exclude_entity=True)

async def _run_task(self):
await self.loop.run_in_executor(None, self._resolve_names)
3 changes: 2 additions & 1 deletion Insight/InsightSubsystems/Cron/CronTasks/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@
from InsightSubsystems.Cron.CronTasks.TicketUtilizationMetrics import TicketUtilizationMetrics_Servers, \
TicketUtilizationMetrics_Channels, TicketUtilizationMetrics_Users
from InsightSubsystems.Cron.CronTasks.NamesDoomheim import NamesDoomheim
from InsightSubsystems.Cron.CronTasks.ClearTmpTables import ClearTmpTables
from InsightSubsystems.Cron.CronTasks.ClearTmpTables import ClearTmpTables
from InsightSubsystems.Cron.CronTasks.ResolveNonEntityNames import ResolveNonEntityNames

0 comments on commit 396c514

Please sign in to comment.