From 6df1f492086c324f9af5405edb5f8adde1318df1 Mon Sep 17 00:00:00 2001 From: Matchu Date: Thu, 23 Jun 2022 11:57:32 -0700 Subject: [PATCH] Add a limit to the modeling query MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Right now it returns 50 rows; each item that needs modeling returns 1–4 rows, usually 1. So a limit of 200 should be pretty dangerous, while also creating a release valve if there's another future bug: it'll just have the problem of returning too few items, instead of the problem of crashing everything! 😅 --- src/server/loaders.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/server/loaders.js b/src/server/loaders.js index 4726635..44703ca 100644 --- a/src/server/loaders.js +++ b/src/server/loaders.js @@ -611,7 +611,11 @@ async function runItemModelingQuery(db, filterToItemIds) { -- All species modeled except Vandagyre, for items that don't support it OR (NOT T_ITEMS.supports_vandagyre AND modeled_species_count = 54 AND modeled_species_ids = "1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54") ) - ORDER BY T_ITEMS.item_id; + ORDER BY T_ITEMS.item_id + -- We limit the result set a bit, because if there's a bug or something + -- that causes too many records to return, it seems to have a tendency to + -- take up a bunch of resources and crash the site? + LIMIT 200; `, [...itemIdsValues] );