mirror of
https://git.ianrenton.com/ian/spothole.git
synced 2026-09-20 14:27:42 +00:00
Merge branch 'main' into 147-sig-activity-changes
# Conflicts: # providers/activityrefdata/activity_ref_data_provider.py
This commit is contained in:
@@ -38,8 +38,10 @@ class ActivityRefDataProvider:
|
||||
def _add_data(self, new_data):
|
||||
"""Add all the provided reference data objects to the data store."""
|
||||
|
||||
# with transact() batches all writes together to save making thousands of individual sqlite writes
|
||||
with DATA_STORE.activity_refs.transact():
|
||||
# with transact() batches all writes together to save making thousands of individual sqlite writes. However,
|
||||
# that means that each provider holds the lock while it writes, and the default behaviour for other attempted
|
||||
# transact()s is to fail if they can't get the lock (?!). This behaviour is fixed by retry=True.
|
||||
with DATA_STORE.activity_refs.transact(retry=True):
|
||||
for d in new_data:
|
||||
DATA_STORE.activity_refs.set(f"{self.sig_name}:{d.id}", d)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user