HubSpot / hubspot-php

HubSpot PHP API Client

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sequential page requests causing slow response on get crm()->companies()->getAll()

joelperry93 opened this issue · comments

Hi,

Been using the library to get all of our companies back and noticed it takes about a minute to do so. On inspection it seems to be firing 118 Guzzle requests in series (so it seems). Each individual request is nice and quick but in total it makes up for a long wait. I can see the API doesn't allow you to increase the page size to over 100. Is it possible to fire these requests in parallel to reduce wait time? Or will the API complain of "too many requests".

Thanks!

commented

Hi @joelperry93
You can try to fire these requests in parallel using method crm()->companies()->basicApi()->getPage()
for avoiding "too many requests" you can set up Retry Middleware
also you can check Retry Middleware Sample App

That getPage method won't allow requesting all pages in parallel because you don't know what the $after param needs to be without first requesting the previous page.