I have a for loop in an asynchronous function where not all console logs are logging, making it almost impossible to track.
I have attached the edited code for the function (I’ve generalized titles etc for data safety).
I’m primarily a python dev and work very little with typescript so I wonder if its a core concept that I’m missing here.
public async getParticipants(options: GetParticipantsOptions) {
options = {...defaultGetParticipantsOptions, ...options};
const {id, filter, offset, limit} = options;
console.log('getParticipants happening') // logs every time
let i = 0
let j = 50
let temp_offset = 0
let count = 10000
console.log('participants filter ' + j.toString())
for (let i = 0; i < j; i++) {
console.log('looping participants ' + i.toString()) // logs every time
let temp_result = await this.invokeapifunction('apicall', {
options // removing due to security
}) // this function returns a promise
// THIS IS WHERE THE LOGS GET FUNKY
console.log('participant list ' + JSON.stringify(temp_result)) // Logs about 1/10 times
console.log('participant list type ' + typeof(temp_result.participants)) // logs every time
temp_result.participants.forEach(element => {
console.log('Singular participant ' + element) // logs every time
participants_total.push(element)
});
temp_offset += 200
count = temp_result.count
console.log('participants total ' + participants_total) // Logs about 1/5 times, never logs in later moments
if (temp_offset >= count) {
console.log('End of participants found') // logs every time
break
}
console.log('participants offset ' + temp_offset) // logs every time
}
console.log('participants total' + participants_total) // never logs
return result
Without these logs I’m never constructing that final participants total object (or able to track it) meaning I cannot ever get to the next step which is transforming that information for the final result we are looking for to load in the UI.
Any help would be appreciated!
Also, just confirming, NO ERRORS are logged in response to this. We have seen some floodwait errors come up, but on average we do not. As in, we are still getting partial logging even when the API is showing no floodwait errors.