dtolnay/star-history

Iterate stargazers from both directions

Open

#10 opened on Jul 16, 2022

View on GitHub
 (0 comments) (0 reactions) (0 assignees)Rust (12 forks)github user discovery
help wanted

Repository metrics

Stars
 (201 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

For repos with lots of stars, we should be able to traverse all the stars in half as many GraphQL requests by iterating the stargazers simultaneously from the start and end.

Before:

repository(owner: "...", name: "...") {
  stargazers(after: "...", first: 100) {
    pageInfo {
      hasNextPage
      endCursor
    }
    edges {...}
  }
}

After:

repository(owner: "...", name: "...") {
  forward: stargazers(after: "...", first: 100) {
    pageInfo {
      hasNextPage
      endCursor
    }
    edges {...}
  }
  backward: stargazers(before: "...", last: 100) {
    pageInfo {
      hasPreviousPage
      startCursor
    }
    edges {...}
  }
}

Contributor guide