Skip to content

Commit

Permalink
Merge pull request #65 from pluralsh/klink/apollo-retry
Browse files Browse the repository at this point in the history
feat: Use apollo RetryLink to reduce broken deploys
  • Loading branch information
dogmar authored Nov 13, 2023
2 parents 1b018d9 + fdb3f52 commit 68f8194
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
3 changes: 1 addition & 2 deletions pages/about.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,7 @@ export type PricingPageProps = { teamMembers: TeamMemberFragment[] }
export const getStaticProps: GetStaticProps<PricingPageProps> = async (
_context
) => {
const { data: teamMembers, error: teamMembersError } = await getTeamMembers()
const { data: teamMembers } = await getTeamMembers()

if (!teamMembers) {
return { notFound: true }
Expand All @@ -307,6 +307,5 @@ export const getStaticProps: GetStaticProps<PricingPageProps> = async (
'We are building a flexible, scalable solution to application delivery.',
teamMembers,
footerVariant: FooterVariant.kitchenSink,
errors: [...(teamMembersError ? [teamMembersError] : [])],
})
}
2 changes: 1 addition & 1 deletion pages/careers/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,6 @@ export const getStaticProps = async () => {
'We are a growing team working on interesting problems in the cloud with Kubernetes, Elixir, Go, and React. We’re always interested in hiring new talent!',
footerVariant: FooterVariant.kitchenSink,
jobs: jobs || [],
errors: [...(jobsError ? [jobsError] : [])],
errors: [...(jobsError ? [jobsError.message] : [])],
})
}
20 changes: 17 additions & 3 deletions src/apollo-client.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,30 @@
import { ApolloClient, InMemoryCache } from '@apollo/client'
import { ApolloClient, ApolloLink, InMemoryCache } from '@apollo/client'
import { HttpLink } from '@apollo/client/link/http'
import { RetryLink } from '@apollo/client/link/retry'

const pluralRetryLink = new RetryLink()

const pluralHttpLink = new HttpLink({ uri: 'https://app.plural.sh/gql' })
const pluralLink = ApolloLink.from([pluralRetryLink, pluralHttpLink])

const client = new ApolloClient({
uri: 'https://app.plural.sh/gql',
link: pluralLink,
cache: new InMemoryCache(),
})

const directusToken = process.env.DIRECTUS_ACCESS_TOKEN

export const directusClient = new ApolloClient({
const directusRetryLink = new RetryLink()

const directusHttpLink = new HttpLink({
uri: `https://directus.plural.sh/graphql${
directusToken ? `?access_token=${directusToken}` : ''
}`,
})
const directusLink = ApolloLink.from([directusRetryLink, directusHttpLink])

export const directusClient = new ApolloClient({
link: directusLink,
cache: new InMemoryCache(),
})

Expand Down

0 comments on commit 68f8194

Please sign in to comment.