API rate limit or error/timeout?

Hi,


I am trying to update/create/add records/gifts etc for 6000+ constituents using the API. It works fine, I can do 20 or so without a problem but it always stops after a minute. It doesn't seem to matter how slowly I make it run, i.e pausing after each call, refereshing token. it still seems to get to about a minute and then it stops.Could it be cause of a bad call? I was trying to monitor it through the analytics page to see but it seems fine.. I will keep checking that. I just can't think why it stops, I slowed it down to process just 1 record over 4 calls very slowly then it just processed that one.. it feels to me like it times out after a minute. Any ideas :/


Happy New year to all :D

Comments

  • I see now, none failed. Made 20 successful calls for that run, processed 4 records in total. It's not calling an end point faster than once every 2 seconds either. I refresh token for each new record, if I don't, still same result though.
  • Analytics show all returned codes to be successful codes.
  • Ah it is probably php, silly me. It's because I set it up to not timeout already but I probably missed a setting in ini file. Must be that ^ ^
  • Check the return codes of the API HTTP requests.


    If there's an error occurring after that minute, chances are you're getting a 429 Too Many Requests response. If the SKY API throws that error, it will also include a Retry-After HTTP response header with the number of seconds to wait. Check these two resources: That said, 2 requests per second appears to be well within the rate limit for standard subs.


    Another possibility is running out of memory, if you aren't aggressively managing variable scope. For large looping contexts like that, I usually try to make sure only 1 record is in memory at a time. (E.g. use single-record DB cursors, parse a single line of a CSV, or use a streaming XML parser.)


    What error does PHP report in the logs after the minute?

Categories