Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calling nftEntitiesConnection timeout when using where "events_some" #58

Open
hassnian opened this issue Jan 31, 2024 · 1 comment
Open
Labels

Comments

@hassnian
Copy link

hassnian commented Jan 31, 2024

there's a good chance it's coming from event_some, maybe it's missing some primary key on indexer

Originally posted by @roiLeo in kodadot/nft-gallery#9175 (comment)

The following query ends up timing out

nftEntitiesConnection(
    orderBy: blockNumber_DESC
    where: {
      burned_eq: false
+      events_some: {
+        interaction_eq: BUY
+        currentOwner_eq: $account
+        caller_not_eq: $account
+    }
  }
  ) {
    totalCount
  }

{
  "errors": [
    {
      "message": "canceling statement due to statement timeout",
      "locations": [
        {
          "line": 25,
          "column": 3
        }
      ],
      "path": [
        "sold"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "query": "SELECT count(*) FROM (SELECT true FROM \"nft_entity\" AS \"nft_entity\" WHERE \"nft_entity\".\"burned\" = $1 AND (SELECT true FROM \"event\" AS \"event\" WHERE \"event\".\"caller\" != $2 AND \"event\".\"current_owner\" = $3 AND \"event\".\"interaction\" = $4 AND \"event\".\"nft_id\" = \"nft_entity\".\"id\" LIMIT 1) ORDER BY \"nft_entity\".\"block_number\" DESC LIMIT 101) AS rows",
          "parameters": [
            false,
            "FSMdmCLv5gFZ87YerB3M8ZSQ58BGHdSnreC4J6znWpqPQK9",
            "FSMdmCLv5gFZ87YerB3M8ZSQ58BGHdSnreC4J6znWpqPQK9",
            "BUY"
          ],
          "driverError": {
            "length": 109,
            "name": "error",
            "severity": "ERROR",
            "code": "57014",
            "file": "postgres.c",
            "line": "3312",
            "routine": "ProcessInterrupts"
          },
          "length": 109,
          "severity": "ERROR",
          "code": "57014",
          "file": "postgres.c",
          "line": "3312",
          "routine": "ProcessInterrupts",
          "sql": "SELECT count(*) FROM (SELECT true FROM \"nft_entity\" AS \"nft_entity\" WHERE \"nft_entity\".\"burned\" = $1 AND (SELECT true FROM \"event\" AS \"event\" WHERE \"event\".\"caller\" != $2 AND \"event\".\"current_owner\" = $3 AND \"event\".\"interaction\" = $4 AND \"event\".\"nft_id\" = \"nft_entity\".\"id\" LIMIT 1) ORDER BY \"nft_entity\".\"block_number\" DESC LIMIT 101) AS rows",
          "stacktrace": [
            "QueryFailedError: canceling statement due to statement timeout",
            "    at PostgresQueryRunner.query (/squid/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19)",
            "    at runMicrotasks (<anonymous>)",
            "    at processTicksAndRejections (node:internal/process/task_queues:96:5)",
            "    at async DataSource.query (/squid/node_modules/typeorm/data-source/DataSource.js:341:20)",
            "    at async EMDatabase.query (/squid/node_modules/@subsquid/graphql-server/lib/typeorm.js:12:23)",
            "    at async TypeormOpenreaderContext.executeQuery (/squid/node_modules/@subsquid/graphql-server/lib/typeorm.js:41:22)",
            "    at async resolve (/squid/node_modules/@subsquid/openreader/lib/opencrud/schema.js:483:30)"
          ]
        }
      }
    }
  ],
  "data": null
}

Originally posted by @hassnian in kodadot/nft-gallery#9175 (comment)


  eventsConnection(
    orderBy: blockNumber_ASC
    where: {
      nft: {burned_eq: false},
      interaction_eq: BUY
      currentOwner_eq: "FSMdmCLv5gFZ87YerB3M8ZSQ58BGHdSnreC4J6znWpqPQK9"
      caller_not_eq: "FSMdmCLv5gFZ87YerB3M8ZSQ58BGHdSnreC4J6znWpqPQK9"
  }) {
    totalCount
  }

@vikiival
Copy link
Member

Wrong repo :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants