Skip to content

Commit

Permalink
add SQLite URI nolock and shared cache components
Browse files Browse the repository at this point in the history
  • Loading branch information
oschwengers committed Oct 12, 2021
1 parent 888bb9b commit e658a2e
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion bakta/ips.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def lookup(features):
features_found = []
features_not_found = []
rec_futures = []
with sqlite3.connect(f"file:{cfg.db_path.joinpath('bakta.db')}?mode=ro", uri=True, check_same_thread=False) as conn:
with sqlite3.connect(f"file:{cfg.db_path.joinpath('bakta.db')}?mode=ro&nolock=1&cache=shared", uri=True, check_same_thread=False) as conn:
conn.execute('PRAGMA omit_readlock;')
conn.row_factory = sqlite3.Row
with ThreadPoolExecutor(max_workers=max(10, cfg.threads)) as tpe: # use min 10 threads for IO bound non-CPU lookups
Expand Down
2 changes: 1 addition & 1 deletion bakta/psc.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def lookup(features):
no_psc_lookups = 0
try:
rec_futures = []
with sqlite3.connect(f"file:{cfg.db_path.joinpath('bakta.db')}?mode=ro", uri=True, check_same_thread=False) as conn:
with sqlite3.connect(f"file:{cfg.db_path.joinpath('bakta.db')}?mode=ro&nolock=1&cache=shared", uri=True, check_same_thread=False) as conn:
conn.execute('PRAGMA omit_readlock;')
conn.row_factory = sqlite3.Row
with ThreadPoolExecutor(max_workers=max(10, cfg.threads)) as tpe: # use min 10 threads for IO bound non-CPU lookups
Expand Down
2 changes: 1 addition & 1 deletion bakta/pscc.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def lookup(features):
no_pscc_lookups = 0
try:
rec_futures = []
with sqlite3.connect(f"file:{cfg.db_path.joinpath('bakta.db')}?mode=ro", uri=True, check_same_thread=False) as conn:
with sqlite3.connect(f"file:{cfg.db_path.joinpath('bakta.db')}?mode=ro&nolock=1&cache=shared", uri=True, check_same_thread=False) as conn:
conn.execute('PRAGMA omit_readlock;')
conn.row_factory = sqlite3.Row
with ThreadPoolExecutor(max_workers=max(10, cfg.threads)) as tpe: # use min 10 threads for IO bound non-CPU lookups
Expand Down
2 changes: 1 addition & 1 deletion bakta/ups.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def lookup(features):
features_found = []
features_not_found = []
rec_futures = []
with sqlite3.connect(f"file:{cfg.db_path.joinpath('bakta.db')}?mode=ro", uri=True, check_same_thread=False) as conn:
with sqlite3.connect(f"file:{cfg.db_path.joinpath('bakta.db')}?mode=ro&nolock=1&cache=shared", uri=True, check_same_thread=False) as conn:
conn.execute('PRAGMA omit_readlock;')
conn.row_factory = sqlite3.Row
with ThreadPoolExecutor(max_workers=max(10, cfg.threads)) as tpe: # use min 10 threads for IO bound non-CPU lookups
Expand Down

0 comments on commit e658a2e

Please sign in to comment.