Add some debugging information for myself to debug triggers not firing when expected
This commit is contained in:
parent
3303f9a939
commit
e5caf72829
@ -21,9 +21,14 @@ class UpdateTrigger:
|
||||
def last_trigger(self) -> Tuple[datetime.datetime, int] | None:
|
||||
return self._last_trigger
|
||||
|
||||
@property
|
||||
def last_alerting(self) -> Tuple[datetime.datetime, int] | None:
|
||||
return self._last_alerting
|
||||
|
||||
@property
|
||||
def squelched(self):
|
||||
return self._squelched
|
||||
|
||||
def _find_next_trigger(self, comparison_operator: operator, starting_point: datetime.datetime, history: List[Tuple[datetime.datetime, int]]):
|
||||
candidate_datum : Tuple[datetime.datetime, int] | None = None
|
||||
for datum in history:
|
||||
@ -99,4 +104,4 @@ class UpdateTrigger:
|
||||
return not was_squelched
|
||||
elif self._squelched:
|
||||
self._squelched = False
|
||||
return False
|
||||
return False
|
||||
|
@ -368,8 +368,20 @@ class Tracker(Extension):
|
||||
history = await self._history_manager.get_history(alert.flavor, alert.region)
|
||||
trigger = await history.find_update_trigger_from_alert(alert)
|
||||
if trigger.last_trigger is not None:
|
||||
alert_str = (f"Last Alerting Price Value: {format(trigger.last_alerting()[1], ",")}\n"
|
||||
f"Last Alerting Time: {trigger.last_alerting()[0].strftime('%Y-%m-%d %H:%M:%S UTC')}\n")
|
||||
alert_str = (f"Last Alerting Price Value: {format(trigger.last_alerting[1], ",")}\n"
|
||||
f"Last Alerting Time: {trigger.last_alerting[0].strftime('%Y-%m-%d %H:%M:%S UTC')}\n")
|
||||
if is_owner():
|
||||
alert_str += (f"\nShowing you some internals since you are the bot owner:\n"
|
||||
f"```history.last_price_datum:\n"
|
||||
f"\t{history.last_price_datum[0].strftime('%Y-%m-%d %H:%M:%S UTC')}\n"
|
||||
f"\t{history.last_price_datum[1]}\n"
|
||||
f"trigger.last_alerting:\n"
|
||||
f"\t{trigger.last_alerting[0].strftime('%Y-%m-%d %H:%M:%S UTC')}\n"
|
||||
f"\t{trigger.last_alerting[1]}\n"
|
||||
f"trigger.last_trigger:\n"
|
||||
f"\t{trigger.last_trigger[0].strftime('%Y-%m-%d %H:%M:%S UTC')}\n"
|
||||
f"\t{trigger.last_trigger[1]}\n"
|
||||
f"trigger.squelched:\n\t{trigger.squelched}```")
|
||||
else:
|
||||
alert_str = "You should only be seeing this if the bot has not finished importing history at startup."
|
||||
fields.append(
|
||||
|
Loading…
Reference in New Issue
Block a user