Dev-iL commented on code in PR #58190:
URL: https://github.com/apache/airflow/pull/58190#discussion_r2517596010
##########
airflow-core/src/airflow/jobs/job.py:
##########
@@ -247,7 +247,9 @@ def heartbeat(
session.merge(self)
self.latest_heartbeat = timezone.utcnow()
session.commit()
- time_since_last_heartbeat = (timezone.utcnow() -
previous_heartbeat).total_seconds()
+ time_since_last_heartbeat: float = 0
+ if previous_heartbeat is not None:
+ time_since_last_heartbeat = (timezone.utcnow() -
previous_heartbeat).total_seconds()
Review Comment:
nit: this can be a ternary operation to avoid assigning to
`time_since_last_heartbeat` twice
```suggestion
time_since_last_heartbeat: float = 0 if
previous_heartbeat is None else (timezone.utcnow() -
previous_heartbeat).total_seconds()
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]