File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed
Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change @@ -162,14 +162,17 @@ class GeneNormalizerBuilder:
162162 """Singleton constructor for Gene Normalizer instance."""
163163
164164 def __new__ (cls ) -> QueryHandler :
165- """Provide Gene Normalizer instance. Construct it if unavailable.
165+ """Provide Gene Normalizer instance. If an instance has already been
166+ constructed, close its connection and provide a new one.
166167
167168 :return: singleton instance of ``QueryHandler`` for Gene Normalizer
168169 """
169- if not hasattr (cls , "instance" ):
170- db = create_db ()
171- q = QueryHandler (db )
172- cls .instance = q
170+ if hasattr (cls , "instance" ):
171+ cls .instance .db .close_connection ()
172+ cls .instance = None
173+
174+ db = create_db ()
175+ cls .instance = QueryHandler (db )
173176 return cls .instance
174177
175178
You can’t perform that action at this time.
0 commit comments