Skip to content

Commit

Permalink
add a garbage collector when SfincsAdapter is deleted to make sure th…
Browse files Browse the repository at this point in the history
…at open file handles are closed
  • Loading branch information
panosatha committed Feb 7, 2024
1 parent 591f43e commit a1ba0d2
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions flood_adapt/integrator/sfincs_adapter.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import gc
import logging
import os
from pathlib import Path
Expand Down Expand Up @@ -57,6 +58,7 @@ def __del__(self):
# Close the log file associated with the logger
for handler in self.sfincs_logger.handlers:
handler.close()
gc.collect()

def set_timing(self, event: EventModel):
"""Changes model reference times based on event time series."""
Expand Down

0 comments on commit a1ba0d2

Please sign in to comment.