uranusjr commented on code in PR #50730:
URL: https://github.com/apache/airflow/pull/50730#discussion_r2099906836
##########
airflow-core/src/airflow/dag_processing/manager.py:
##########
@@ -1034,10 +1054,11 @@ def _kill_timed_out_processors(self):
)
self._file_stats[file] = stat
- # Clean up `self._processors` after iterating over it
+ # Clean up timed-out `self._processors` after iterating over it
for proc in processors_to_remove:
- processor = self._processors.pop(proc)
- processor.logger_filehandle.close()
+ processor = self._processors.pop(proc, None)
+ if processor:
+ processor.logger_filehandle.close()
Review Comment:
```suggestion
if processor := self._processors.pop(proc, None):
processor.logger_filehandle.close()
```
There are elsewhere that can benefit from this pattern too.
--
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]