GESI - advanced usage

again more questions arise :slight_smile:

i have made a little google-script with GESI to update transactions

now it does work quite well but i did reach my urlfetch-limit pretty fast
my guess is, the way i wrote the script, it does invoke a client-call with every loop
but i’m not sure if it does, and i have no idea how to avoid it

thanks for any help

the important part of the script

function updateTrans() {
var client = GESI.getClient().setFunction(‘corporations_corporation_wallets_division_transactions’);
var type_data = client.execute({division: 6});

for (var i=data_length-1; i>-1; i–) {
new_id = type_data[i][6];
if (new_id>last_id) {
for (var j=0; j<data_width; j++) {

As it stands, this code only makes 1 request to ESI when it first starts. The real questions is how often are you invoking it?

hmmm, thanks

well, i start the script once through a UI-Item

not sure, why i got the urlfetch error then

i also get lots of timeout-errors - at least sometimes - with my GESI-requests in the table cells - probably because they are now several hundred - that’s why i’m working on invoking everything through script to have more control over it
maybe google updated my GESI-calls in the cells to often… no idea

What functions are you using? It’s possible you’re making a lot more requests than you think.

in the script i just use the one above

in the cells i use things like this:
QUERY(markets_region_history(A5; $B$1; FALSE); “Select avg(Col5), avg(Col6) LABEL avg(Col5) ‘’, avg(Col6) ‘’”; FALSE)

ARRAY_CONSTRAIN(QUERY(markets_region_history(A5; $B$1; FALSE); “Select Col5, Col6”; FALSE); 1; 2)

QUERY(markets_region_orders($B$1; “sell”; A5); “select sum(Col11) WHERE Col4=60003760 LABEL sum(Col11) ‘’”; 0)

that’s 3 per item, around 100 items

there are a few more tabs, but nothing heavy - i think

To be clear if you’re fetching orders for a single item from jita that’s going to be more than 1 request as each page is its own request. You would be better off fetching all the data and filtering it down. I.e. load in market history data in a dedicated sheet, then vlookup what you need in other cells, versus using the function with the cell itself.

It would also be more efficient if you used a custom function to fetch price data. I.e. fetch the entire market, keep track of the specific orders you want and output it to a dedicated sheet, then again, vlookup what you need from there.

ok thanks

i know what you mean in general (and i do use data tables with lookups already at some points) - just have to check what that means in detail in this case

i may come back with more questions :slight_smile:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.