I am finding that there is about a 20 second delay between the mutation of an item and the queryability of that mutation in the GraphQL API. I mutate an order by adding a tag, and then I query all orders without that tag; GraphQL responds with that very order up until around 20 seconds have passed. The kicker is that the response even acknowledges that the order contains the tag! Here’s an example of my query and the response:
Query:
{ orders(query: “-tag:giftcardsCreated AND unpaid:false AND created_at:>=‘2021-12-08T11:40:18-08:00’”, first: 5) {> edges {> cursor> node {> id> email> tags> lineItems (first: 45){> edges {> node {> sku> quantity> }> }> }> }> }> }> }
Response:
{> “extensions”: {> etc.> },> “data”: {> “orders”: {> “edges”: [> {> “cursor”: “(cursor)”,> “node”: {> “lineItems”: {> “edges”: [> {> “node”: {> “quantity”: 3,> “sku”: “(sku)”> }> }> ]> },> “id”: “gid://shopify/Order/(id)”,> “email”: “(email)”,> “tags”: [> “giftcardsCreated”> ]> }> }> ]> }> }> }
So the query “-tag:giftcardsCreated” returns an order with “tags: giftcardsCreated”. After 20 seconds, this query correctly responds with no orders.
But it gets worse. I decided to test this in the GraphQL app and discovered that the query actually oscillates near the 20 second mark, making the order queryable, unqueryable, and queryable again. You can test this yourself by tagging an order, then repeatedly querying it with something similar to the query I used. After about 15 seconds, you’ll see that sometimes the query catches the order and sometimes it doesn’t, until enough time has passed and it becomes completely unqueryable (as it should be).
I have not been able to find any other forum posts or documentation on this. Is the backend database different than the database that the query filter accesses, and if so, what exactly is the delay, and is it variable? I can’t think of any other reason why this type of issue would exist.