Skip to content

Commit

Permalink
Add logging.
Browse files Browse the repository at this point in the history
  • Loading branch information
dboulware committed Mar 14, 2024
1 parent 521518a commit 23faff1
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions scos_actions/calibration/sensor_calibration.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ def update(
def expired(self) -> bool:
env = Env()
time_limit = env.int("CALIBRATION_EXPIRATION_LIMIT", default=None)
logger.debug("Checking if calibration has expired.")
if time_limit is None:
return False
elif self.calibration_data is None:
Expand Down Expand Up @@ -121,5 +122,8 @@ def date_expired(cal_data: dict, now: datetime, time_limit: int):
cal_datetime = parse_datetime_iso_format_str(cal_data["datetime"])
elapsed = now - cal_datetime
if elapsed.total_seconds() > time_limit:
logger.debug(
f"Calibration {cal_data} has expired at {elapsed.total_seconds()} seconds old."
)
return True
return False

0 comments on commit 23faff1

Please sign in to comment.