I'm making an Chrome Extension which interacts with Gmail API.
Basically it needs to extract email senders from emails that match some keyword.
Problem is that sometimes there are over 10K emails matching this keyword.
I utilize gapi.client.gmail.users.messages.list
to fetch all emails that match entered keyword, but this only returns email and thread IDs, so I need to call gapi.client.gmail.users.messages.get
for each email ID retrieved from messages.list
.
So there are over 10K requests to Gmail API, and I run into ERR_INSUFFICIENT_RESOURCES
error in Chrome. To prevent this error, I set some timeout between calls to messages.get
but then it would take ages to complete...
Is there some recommended way to get this amount of emails from Gmail API?