]> git.openstreetmap.org Git - nominatim-ui.git/blobdiff - src/components/LastUpdated.svelte
Fix: Missing API and debug links (#132)
[nominatim-ui.git] / src / components / LastUpdated.svelte
index a51b4b6a42e982b6e47235beea48305910b34e87..44738f204b2608e34a2403f44b233623bc6a2a9f 100644 (file)
@@ -6,11 +6,18 @@
 
   let last_updated_date;
   let last_api_request_url;
 
   let last_updated_date;
   let last_api_request_url;
+  let fetch_running = false; // prevent multiple parallel fetch runs
 
   last_api_request_url_store.subscribe(url => {
     last_api_request_url = url;
 
   last_api_request_url_store.subscribe(url => {
     last_api_request_url = url;
+
+    if (fetch_running || last_updated_date) return;
+
+    fetch_running = true;
+
     fetch_from_api('status', { format: 'json' }, function (data) {
       last_updated_date = data.data_updated;
     fetch_from_api('status', { format: 'json' }, function (data) {
       last_updated_date = data.data_updated;
+      fetch_running = false;
     });
   });
 </script>
     });
   });
 </script>