summaryrefslogtreecommitdiff
path: root/searx/data/currencies.py
diff options
context:
space:
mode:
authorMarkus Heiser <markus.heiser@darmarIT.de>2025-07-09 17:32:10 +0200
committerGitHub <noreply@github.com>2025-07-09 17:32:10 +0200
commit2fe8540903c53e3939c86dad6f7f7c0b3162de0f (patch)
tree64f2acede11c732570a64fca37e6e6eee341b1ee /searx/data/currencies.py
parentf798ddd4922d793d5e6ccb7c4111810d549ff4f4 (diff)
[fix] prevent multiple, parallel initializations of tables in the cache DB (#4991)
Depending on the respective runtime behavior, it could happen that the initial loading of the DB tables in the cache was performed multiple times and in parallel. The concurrent accesses then led to the `sqlite3.OperationalError: database is locked` exception as in #4951. Since this problem depends significantly on the runtimes (e.g., how long it takes to retrieve the content for a table), this error could not be observed in all installations. Closes: https://github.com/searxng/searxng/issues/4951 Signed-off-by: Markus Heiser <markus.heiser@darmarit.de>
Diffstat (limited to 'searx/data/currencies.py')
-rw-r--r--searx/data/currencies.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/searx/data/currencies.py b/searx/data/currencies.py
index 0721037a1..504f43ae5 100644
--- a/searx/data/currencies.py
+++ b/searx/data/currencies.py
@@ -24,8 +24,9 @@ class CurrenciesDB:
def init(self):
if self.cache.properties("currencies loaded") != "OK":
- self.load()
+ # To avoid parallel initializations, the property is set first
self.cache.properties.set("currencies loaded", "OK")
+ self.load()
# F I X M E:
# do we need a maintenance .. rember: database is stored
# in /tmp and will be rebuild during the reboot anyway