(Hopefully) fix a bug where several sig ref data providers try to write to the data store simultaneously on startup.

This commit is contained in:
Ian Renton
2026-09-18 18:57:18 +01:00
parent 556ea56378
commit 4b51dd9ba5
9 changed files with 19 additions and 17 deletions
@@ -36,8 +36,10 @@ class SIGRefDataProvider:
def _add_data(self, new_data): def _add_data(self, new_data):
"""Add all the provided reference data objects to the data store.""" """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 transact() batches all writes together to save making thousands of individual sqlite writes. However,
with DATA_STORE.sigrefs.transact(): # 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.sigrefs.transact(retry=True):
for d in new_data: for d in new_data:
DATA_STORE.sigrefs.set(f"{self.sig_name}:{d.id}", d) DATA_STORE.sigrefs.set(f"{self.sig_name}:{d.id}", d)
+1 -1
View File
@@ -77,7 +77,7 @@
</div> </div>
<script src="/static/js/add-spot.js?v=1789731849"></script> <script src="/static/js/add-spot.js?v=1789754238"></script>
<script>$(document).ready(function () { <script>$(document).ready(function () {
$("#nav-link-add-spot").addClass("active"); $("#nav-link-add-spot").addClass("active");
}); <!-- highlight active page in nav --></script> }); <!-- highlight active page in nav --></script>
+1 -1
View File
@@ -83,7 +83,7 @@
</div> </div>
<script src="/static/js/alerts.js?v=1789731849"></script> <script src="/static/js/alerts.js?v=1789754238"></script>
<script>$(document).ready(function () { <script>$(document).ready(function () {
$("#nav-link-alerts").addClass("active"); $("#nav-link-alerts").addClass("active");
}); <!-- highlight active page in nav --></script> }); <!-- highlight active page in nav --></script>
+2 -2
View File
@@ -76,8 +76,8 @@
</div> </div>
<script src="/static/js/spotsbandsandmap.js?v=1789731849"></script> <script src="/static/js/spotsbandsandmap.js?v=1789754238"></script>
<script src="/static/js/bands.js?v=1789731849"></script> <script src="/static/js/bands.js?v=1789754238"></script>
<script>$(document).ready(function () { <script>$(document).ready(function () {
$("#nav-link-bands").addClass("active"); $("#nav-link-bands").addClass("active");
}); <!-- highlight active page in nav --></script> }); <!-- highlight active page in nav --></script>
+5 -5
View File
@@ -1,6 +1,6 @@
{% extends "skeleton.html" %} {% extends "skeleton.html" %}
{% block head_extra %} {% block head_extra %}
<link rel="stylesheet" href="/static/css/style.css?v=1789731849" type="text/css"> <link rel="stylesheet" href="/static/css/style.css?v=1789754238" type="text/css">
<link href="/static/vendor/css/bootstrap-5.3.8.min.css" rel="stylesheet"> <link href="/static/vendor/css/bootstrap-5.3.8.min.css" rel="stylesheet">
<link href="/static/vendor/css/fontawesome-6.7.2.min.css" rel="stylesheet"> <link href="/static/vendor/css/fontawesome-6.7.2.min.css" rel="stylesheet">
<link href="/static/vendor/css/solid-6.7.2.min.css" rel="stylesheet"> <link href="/static/vendor/css/solid-6.7.2.min.css" rel="stylesheet">
@@ -16,10 +16,10 @@
window.fetchEventSource = fetchEventSource; window.fetchEventSource = fetchEventSource;
</script> </script>
<script src="/static/js/utils.js?v=1789731849"></script> <script src="/static/js/utils.js?v=1789754238"></script>
<script src="/static/js/ui-ham.js?v=1789731849"></script> <script src="/static/js/ui-ham.js?v=1789754238"></script>
<script src="/static/js/geo.js?v=1789731849"></script> <script src="/static/js/geo.js?v=1789754238"></script>
<script src="/static/js/common.js?v=1789731849"></script> <script src="/static/js/common.js?v=1789754238"></script>
{% end %} {% end %}
{% block body %} {% block body %}
<div class="container"> <div class="container">
+1 -1
View File
@@ -284,7 +284,7 @@
</div> </div>
<script src="/static/vendor/js/chart-4.4.9.umd.min.js"></script> <script src="/static/vendor/js/chart-4.4.9.umd.min.js"></script>
<script src="/static/js/conditions.js?v=1789731849"></script> <script src="/static/js/conditions.js?v=1789754238"></script>
<script>$(document).ready(function () { <script>$(document).ready(function () {
$("#nav-link-conditions").addClass("active"); $("#nav-link-conditions").addClass("active");
}); <!-- highlight active page in nav --></script> }); <!-- highlight active page in nav --></script>
+2 -2
View File
@@ -113,8 +113,8 @@
const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}"; const CARTODB_API_KEY = "{{ web_ui_options.get('cartodb_api_key', '') }}";
</script> </script>
<script src="/static/js/spotsbandsandmap.js?v=1789731849"></script> <script src="/static/js/spotsbandsandmap.js?v=1789754238"></script>
<script src="/static/js/map.js?v=1789731849"></script> <script src="/static/js/map.js?v=1789754238"></script>
<script>$(document).ready(function () { <script>$(document).ready(function () {
$("#nav-link-map").addClass("active"); $("#nav-link-map").addClass("active");
}); <!-- highlight active page in nav --></script> }); <!-- highlight active page in nav --></script>
+2 -2
View File
@@ -125,8 +125,8 @@
</div> </div>
<script src="/static/js/spotsbandsandmap.js?v=1789731849"></script> <script src="/static/js/spotsbandsandmap.js?v=1789754238"></script>
<script src="/static/js/spots.js?v=1789731849"></script> <script src="/static/js/spots.js?v=1789754238"></script>
<script>$(document).ready(function () { <script>$(document).ready(function () {
$("#nav-link-spots").addClass("active"); $("#nav-link-spots").addClass("active");
}); <!-- highlight active page in nav --></script> }); <!-- highlight active page in nav --></script>
+1 -1
View File
@@ -96,7 +96,7 @@
</div> </div>
</div> </div>
<script src="/static/js/status.js?v=1789731849"></script> <script src="/static/js/status.js?v=1789754238"></script>
<script> <script>
$(document).ready(function () { $(document).ready(function () {
$("#nav-link-status").addClass("active"); $("#nav-link-status").addClass("active");