diff --git a/packages/api/src/jobs/rss/refreshFeed.ts b/packages/api/src/jobs/rss/refreshFeed.ts index ccefcd0d5..f9339d6cc 100644 --- a/packages/api/src/jobs/rss/refreshFeed.ts +++ b/packages/api/src/jobs/rss/refreshFeed.ts @@ -205,75 +205,6 @@ const parseFeed = async (url: string, content: string) => { } } -const sendUpdateSubscriptionMutation = async ( - userId: string, - subscriptionId: string, - lastFetchedAt: Date, - lastFetchedChecksum: string, - scheduledAt: Date -) => { - if (!process.env.INTERNAL_API_URL || !env.server.jwtSecret) { - throw new Error( - 'Can not send update subscription, environment not configured.' - ) - } - const JWT_SECRET = env.server.jwtSecret - const REST_BACKEND_ENDPOINT = `${process.env.INTERNAL_API_URL}/api` - - if (!JWT_SECRET || !REST_BACKEND_ENDPOINT) { - throw 'Environment not configured correctly' - } - - const data = JSON.stringify({ - query: `mutation UpdateSubscription($input: UpdateSubscriptionInput!){ - updateSubscription(input:$input){ - ... on UpdateSubscriptionSuccess{ - subscription{ - id - lastFetchedAt - } - } - ... on UpdateSubscriptionError{ - errorCodes - } - } - }`, - variables: { - input: { - id: subscriptionId, - lastFetchedAt, - lastFetchedChecksum, - scheduledAt, - }, - }, - }) - - const auth = (await signToken({ uid: userId }, JWT_SECRET)) as string - try { - const response = await axios.post( - `${REST_BACKEND_ENDPOINT}/graphql`, - data, - { - headers: { - Cookie: `auth=${auth};`, - 'Content-Type': 'application/json', - }, - timeout: 30000, // 30s - } - ) - - /* eslint-disable @typescript-eslint/no-unsafe-member-access */ - return !!response.data.data.updateSubscription.subscription - } catch (error) { - if (axios.isAxiosError(error)) { - console.error('update subscription mutation error', error.message) - } else { - console.error(error) - } - return false - } -} - const isItemRecentlySaved = async (userId: string, url: string) => { const key = `recent-saved-item:${userId}:${url}` try {