diff --git a/.prettierignore b/.prettierignore index a020d7d1..22f3160b 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1 +1,2 @@ + helm_charts/** diff --git a/taxonium_backend/server.js b/taxonium_backend/server.js index 3d64636b..104a875a 100644 --- a/taxonium_backend/server.js +++ b/taxonium_backend/server.js @@ -227,8 +227,8 @@ app.get("/mutations/", function (req, res) { res.write(`data: ${data}\n\n`); } - // Send mutations in chunks of 1000 - const chunkSize = 10000; + // Send mutations in chunks of 100000 + const chunkSize = 100000; let index = 0; function sendNextChunk() { diff --git a/taxonium_component/src/hooks/useServerBackend.jsx b/taxonium_component/src/hooks/useServerBackend.jsx index e149db62..8170fa96 100644 --- a/taxonium_component/src/hooks/useServerBackend.jsx +++ b/taxonium_component/src/hooks/useServerBackend.jsx @@ -157,7 +157,7 @@ function useServerBackend(backend_url, sid, url_on_fail) { const mutationsChunk = JSON.parse(event.data); if (Array.isArray(mutationsChunk)) { config.mutations.push(...mutationsChunk); - setResult({ ...config }); + console.log( `Received chunk of ${mutationsChunk.length} mutations` ); @@ -172,10 +172,11 @@ function useServerBackend(backend_url, sid, url_on_fail) { eventSource.onerror = (error) => { console.error("EventSource failed:", error); eventSource.close(); + setResult(config); + // TODO atm we set the Result above for backwards compatibility with backends which don't stream mutations and use /config/ + // instead. After a while we should stop doing this so that if the stream dies in the middle we don't get + // possible weird behavior. }; - - // Set initial config - setResult(config); }) .catch((error) => { console.error("Error fetching config:", error);