[wip] remove connection pool from sqlite
Sqlite connection is not thread-safe. We use complicated and unstable pooling to make connections thread-safe. We don't need to do any locking if we just open the connection per each thread.
The tests are also much more stable now.
Could
def _cursorjustyield con.cursor()instead ofcur = con.cursor() yield cur.execute(sql, *args)?
We can rewrite this
with self._cursor( insert_sql, [str(key), _repr_debug_(value), data, str(key)] ) as _: passinto
with self._cursor as cursor: cursor.execute(insert_sql, [str(key), _repr_debug_(value), data, str(key)])looks a bit more idiomatic to me.
I agree that it looks better, but I think this change is out of scope for this PR as it leads to much bigger refactoring. I will create an issue for this one though.
I figured out some problems with this implementation and database locked errors are still there, when several jobs are launched.