Skip to content

Commit

Permalink
Add minimum batch size to avoid infinite loop due to zero batch size
Browse files Browse the repository at this point in the history
  • Loading branch information
knabar committed Nov 6, 2024
1 parent 213bb61 commit 6bba7f7
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,10 +213,11 @@ <h2>{{ data.name }}</h2>
enableDownloadButtons(false);
const rowCount = filter ? parseInt("{{ meta.totalCount }}") : parseInt("{{ meta.rowCount }}");
const tableName = "{{ data.name }}.csv";
// Use 10 batches, or max 3000 rows per batch
// Use 10 batches, or max 3000 rows per batch, with a minimum of 10
const MAX_BATCH_ROWS = 3000;
const MIN_BATCH_ROWS = 10;
const MAX_FAILED_CALLS = 5;
const batchSize = Math.min(parseInt(rowCount/10), MAX_BATCH_ROWS);
const batchSize = Math.max(Math.min(parseInt(rowCount/10), MAX_BATCH_ROWS), MIN_BATCH_ROWS);

// load csv in batches...
const csvUrl = "{% url 'omero_table' data.id 'csv' %}";
Expand Down

0 comments on commit 6bba7f7

Please sign in to comment.