Always-online persisted queries

Jul 23rd, 2021view comments

There is a new "Fallback on error" option when you create a persisted query. Use it to keep your queries online even when the underlying API is down or you hit a rate-limit.

To use it, you also need to add caching to the query.

You can create a persisted query from the Persisted Queries section of the OneGraph dashboard, or with a mutation:

mutation PersistQuery($query: String!, $appId: String!) {
  oneGraph {
    createPersistedQuery(
      input: {
        query: $query
        appId: $appId
        cacheStrategy: { timeToLiveSeconds: 600 }
        fallbackOnError: true
      }
    ) {
      persistedQuery {
        id
      }
    }
  }
}

Read more about persisted queries in the docs.