pepkit / pepdbagent

Database for storing sample metadata
BSD 2-Clause "Simplified" License
2 stars 1 forks source link

Add a `__del__` or `__exit__` method #30

Closed nleroy917 closed 2 years ago

nleroy917 commented 2 years ago

I'm wondering if it would be worth it to custom-write a method that closes all potential connections to the database during garbage collection (__del__) or after execution in a context manager (__exit__).

They both would have a calling syntax similar to:

def __del__(self):
    self.close_connection()

This way we avoid dangling connections.