My propsal is to rewrite your code from scratch.
Since your code doesn’t seem to wait for doGetRequest to run/complete
So you cause an infinity loop. and run out of memory/crash the script.
doGetRequest
while(parsed.pagination.cursor) {
doGetRequest(nextpage, {
updatePartse
});
})
Results in
doGetRequest for page zero
doGetRequest for page one
doGetRequest(page1);
doGetRequest(page1);
doGetRequest(page1);
doGetRequest(page1);
doGetRequest(page1);
doGetRequest(page1);
doGetRequest(page1);
doGetRequest(page1);
recieve page 1
doGetRequest(page1);
doGetRequest(page1);
doGetRequest(page1);
doGetRequest(page1);
doGetRequest(page1);
doGetRequest(page1);
doGetRequest(page1);
doGetRequest(page1);
page2processed
doGetRequest(page2);
doGetRequest(page2);
doGetRequest(page2);
doGetRequest(page2);
doGetRequest(page2);
doGetRequest(page2);
doGetRequest(page2);
doGetRequest(page2);
doGetRequest(page2);
Memeory leak and crash
while(parsed.pagination.cursor) { the vlaud in parsed isn’t updated quick enough cause page1 calls to loop whilst page2 call is being made.