Interesting Issue when I hit 71 api calls in 60 seconds

Answered

Comments

9 comments

  • Andreas Garnæs

    Hi Scott,

    It sounds like something could be wrong with your program, but it's hard to help out without looking at the code. Would you be able to share the relevant parts, e.g. on https://gist.github.com/ ?

    Thanks,
    Andreas

    0
    Comment actions Permalink
  • Scott Costello

    Here you go...

    The top level script is the Podio-Setup.php

    https://gist.github.com/anonymous/b014abe9b2bac6406097

    0
    Comment actions Permalink
  • Scott Costello

    Hi Andreas,

    I got it all to work with a combination of adding fields through the PodioApp::create() call and the PodioAppField::Create() call. I reduced down the number of api calls to a point where it works. I'm still puzzled as to why I'm having a problem when I pass 70 api calls from one PHP file though. Even though I managed to get my current solution working, I'm afraid if I need to expand what I'm doing I will run into the same issue.

    0
    Comment actions Permalink
  • Henrik Huhtinen

    Perhaps there is a PHP execution timeout and your browser just reloads the url which starts the script again. I'm a bit puzzled why it would reload, but who knows. Check your PHP settings - make page with just phpinfo(). Also, you could run your script from the command line as it needs no interaction (well, you would have to change to user auth).

    Another idea - have you thought of making a "source workspace" somewhere and just clone the source APPs via API?

    I'm quite sure there is no "71 API calls in one minute" limit in the API ;)

    0
    Comment actions Permalink
  • Scott Costello

    Hi Henrik,

    If there was a timeout somewhere in php settings I would think that the number of calls would change because I'm sure speed of execution changes between runs. I'll check that out anyway because you know what happens when you assume :)

    Let's talk about your source workspace idea...I like it for a number of reasons. Would the install location have to be a member of the sources corporation? In other words, follow the same rules as if you where to install a pack of apps from a private app market pack?

    0
    Comment actions Permalink
  • Henrik Huhtinen

    Scott - ok, I thought the 60 seconds in your post title was an exact time.. but best to check, 60 seconds sounds quite a possible timeout somewhere.

    About the "source workspace" - what is required is just what is required by cloning, right? So the user who is cloning must have access to both source and target workspaces. No need for the workspaces to be in the same organization.

    However I like your method of creating via API much more, so forget about my suggestion. Via API I feel you have more control and it is more reliable (aside from your current issue ;D). For instance if you have a lot of relationships between the apps, cloning between workspaces is tricky. Relationship fields silently drop away while cloning if the target-app of the relationship does not exist in the target workspace.

    0
    Comment actions Permalink
  • Scott Costello

    Henrik,

    The 60 seconds was just a rough time frame because that is what it seemed like the breaking point was. I didn't really give it much thought because the number of API calls was so consistent that I thought there was a cap or something.

    I did some testing with my .htaccess settings for time out and execution time and it didn't seem to have any affect on things. I'm completely at a loss for what is going on. I'll keep running tests.

    However...with the combination of creating fields using the PodioApp::Create(), PodioApp::Update() and the PodioAppField::Create(), I have trimmed my Api calls down to 34. This works perfectly and completes the setup of my Workspace, Apps and Fields. The entire process takes 15 seconds according to the Log.

    I wish I could just create all the fields in the PodioApp::Create() calls, but because I have calculation fields I need to get the field ID of the fields I need to use in the calc fields first. The only way I figured out how to get those IDs is to use PodioAppField::Create() to create any field i need the ID for first and then use the PodioApp::Update() call to create the rest of the fields. It works but it's not as clean and ordered as I would like.

    0
    Comment actions Permalink
  • Scott Costello

    I did some more testing and actually uploaded the php scripts to another host I had (bluehost) and ran some tests. I had ZERO issues executing 125+ api calls. So my conclusion is that my other host (media temple) is the cause of the problem and there is some setting that is behind the issue over there. Perhaps because it's a Wordpress Hosting account they do have some special php settings to keep performance up.

    Gonna transfer all my scripts over to my bluehost account and continue over there.

    Thanks Henrik and Andreas for helping out

    0
    Comment actions Permalink
  • Henrik Huhtinen

    Did you check the output of phpinfo() for timeouts?

    0
    Comment actions Permalink

Please sign in to leave a comment.

Powered by Zendesk