GraphQL API rate limit Issue: "actualQueryCost" and "currentlyAvailable" do not match

GraphQL API rate limit Issue: "actualQueryCost" and "currentlyAvailable" do not match

ArchitecTJ37
Shopify Partner
3 0 3

I wonder if anyone encounter the same issue.

I opened a development store(developer preview is NOT enabled) and developing a private Shopify app.

 

I was working on GraphQL rate limit handling and I studied the blog from https://www.shopify.com/partners/blog/optimize-rate-limit.

 

I made the simplest test by making 3 async API calls to get customers and wanted to see how the API rate cost changes when API response.

 

However, it makes no sense when I look at the rate limit data and do the math. Each API calls' "actualQueryCost" is just 3, but one of the response shows the "currentlyAvailable" is 985 instead of 991 (from: 1000 - 3 * 3).

 

Here is my response(Formatted in JSON and manually swapped some data(due to privacy reason)):

 

{
  "graphqlApiCalls": [
    {
      "body": {
        "data": {
          "customers": {
            "nodes": [
              {
                "id": "gid://shopify/Customer/6439455916286",
                "lastName": "Morrison",
                "firstName": "Morris",
                "email": "test1@gmail.com",
                "phone": "+1234567890"
              }
            ]
          }
        },
        "extensions": {
          "cost": {
            "requestedQueryCost": 12,
            "actualQueryCost": 3,
            "throttleStatus": {
              "maximumAvailable": 1000,
              "currentlyAvailable": 994,
              "restoreRate": 50
            },
            "fields": [
              {
                "path": [
                  "customers",
                  "nodes",
                  "id"
                ],
                "definedCost": 0,
                "requestedTotalCost": 0,
                "requestedChildrenCost": null
              },
              {
                "path": [
                  "customers",
                  "nodes",
                  "lastName"
                ],
                "definedCost": 0,
                "requestedTotalCost": 0,
                "requestedChildrenCost": null
              },
              {
                "path": [
                  "customers",
                  "nodes",
                  "firstName"
                ],
                "definedCost": 0,
                "requestedTotalCost": 0,
                "requestedChildrenCost": null
              },
              {
                "path": [
                  "customers",
                  "nodes",
                  "email"
                ],
                "definedCost": 0,
                "requestedTotalCost": 0,
                "requestedChildrenCost": null
              },
              {
                "path": [
                  "customers",
                  "nodes",
                  "phone"
                ],
                "definedCost": 0,
                "requestedTotalCost": 0,
                "requestedChildrenCost": null
              },
              {
                "path": [
                  "customers",
                  "nodes"
                ],
                "definedCost": 1,
                "requestedTotalCost": 1,
                "requestedChildrenCost": 0
              },
              {
                "path": [
                  "customers"
                ],
                "definedCost": null,
                "requestedTotalCost": 12,
                "requestedChildrenCost": 1
              }
            ]
          }
        }
      },
      "headers": {}
    },
    {
      "body": {
        "data": {
          "customers": {
            "nodes": [
              {
                "id": "gid://shopify/Customer/6513260560638",
                "lastName": "Morrison",
                "firstName": "Morris",
                "email": "test2@gmail.com",
                "phone": "+123456789"
              }
            ]
          }
        },
        "extensions": {
          "cost": {
            "requestedQueryCost": 12,
            "actualQueryCost": 3,
            "throttleStatus": {
              "maximumAvailable": 1000,
              "currentlyAvailable": 985,
              "restoreRate": 50
            },
            "fields": [
              {
                "path": [
                  "customers",
                  "nodes",
                  "id"
                ],
                "definedCost": 0,
                "requestedTotalCost": 0,
                "requestedChildrenCost": null
              },
              {
                "path": [
                  "customers",
                  "nodes",
                  "lastName"
                ],
                "definedCost": 0,
                "requestedTotalCost": 0,
                "requestedChildrenCost": null
              },
              {
                "path": [
                  "customers",
                  "nodes",
                  "firstName"
                ],
                "definedCost": 0,
                "requestedTotalCost": 0,
                "requestedChildrenCost": null
              },
              {
                "path": [
                  "customers",
                  "nodes",
                  "email"
                ],
                "definedCost": 0,
                "requestedTotalCost": 0,
                "requestedChildrenCost": null
              },
              {
                "path": [
                  "customers",
                  "nodes",
                  "phone"
                ],
                "definedCost": 0,
                "requestedTotalCost": 0,
                "requestedChildrenCost": null
              },
              {
                "path": [
                  "customers",
                  "nodes"
                ],
                "definedCost": 1,
                "requestedTotalCost": 1,
                "requestedChildrenCost": 0
              },
              {
                "path": [
                  "customers"
                ],
                "definedCost": null,
                "requestedTotalCost": 12,
                "requestedChildrenCost": 1
              }
            ]
          }
        }
      },
      "headers": {}
    },
    {
      "body": {
        "data": {
          "customers": {
            "nodes": [
              {
                "id": "gid://shopify/Customer/6439455916286",
                "lastName": "Morrison",
                "firstName": "Morris",
                "email": "test1@gmail.com",
                "phone": "+1234567890"
              },
              {
                "id": "gid://shopify/Customer/6513260560638",
                "lastName": "Morrison",
                "firstName": "Morris",
                "email": "test2@gmail.com",
                "phone": "+123456789"
              }
            ]
          }
        },
        "extensions": {
          "cost": {
            "requestedQueryCost": 12,
            "actualQueryCost": 3,
            "throttleStatus": {
              "maximumAvailable": 1000,
              "currentlyAvailable": 994,
              "restoreRate": 50
            },
            "fields": [
              {
                "path": [
                  "customers",
                  "nodes",
                  "id"
                ],
                "definedCost": 0,
                "requestedTotalCost": 0,
                "requestedChildrenCost": null
              },
              {
                "path": [
                  "customers",
                  "nodes",
                  "lastName"
                ],
                "definedCost": 0,
                "requestedTotalCost": 0,
                "requestedChildrenCost": null
              },
              {
                "path": [
                  "customers",
                  "nodes",
                  "firstName"
                ],
                "definedCost": 0,
                "requestedTotalCost": 0,
                "requestedChildrenCost": null
              },
              {
                "path": [
                  "customers",
                  "nodes",
                  "email"
                ],
                "definedCost": 0,
                "requestedTotalCost": 0,
                "requestedChildrenCost": null
              },
              {
                "path": [
                  "customers",
                  "nodes",
                  "phone"
                ],
                "definedCost": 0,
                "requestedTotalCost": 0,
                "requestedChildrenCost": null
              },
              {
                "path": [
                  "customers",
                  "nodes"
                ],
                "definedCost": 1,
                "requestedTotalCost": 1,
                "requestedChildrenCost": 0
              },
              {
                "path": [
                  "customers"
                ],
                "definedCost": null,
                "requestedTotalCost": 12,
                "requestedChildrenCost": 1
              }
            ]
          }
        }
      },
      "headers": {}
    }
  ]
}

 

 

Replies 0 (0)