Skip to content

Set sqlite cursor on first call, not on instantiation#1495

Merged
kkaris merged 1 commit into
gyorilab:masterfrom
kkaris:threadlocal-fix
Mar 30, 2026
Merged

Set sqlite cursor on first call, not on instantiation#1495
kkaris merged 1 commit into
gyorilab:masterfrom
kkaris:threadlocal-fix

Conversation

@kkaris
Copy link
Copy Markdown
Contributor

@kkaris kkaris commented Mar 26, 2026

This PR fixes a subtle issue that arises from how the bio_ontology is imported: because an instance of the BioOntology or the SqliteOntology is created when importing bio_ontology from the module, the thread that does the import is the one that owns the self._local attribute. This is apparently a different thread than the ones makings calls to the sqlite database later in at least one multi threading setup that uses the SqliteOntology.

The fix sets self.cur as a property instead of an attribute. On first access to the cursor by a thread, that thread sets its local cursor.

@kkaris kkaris merged commit cf60c50 into gyorilab:master Mar 30, 2026
0 of 2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant