From 1076d2588b30727d44f04ac8b121329d07c3432f Mon Sep 17 00:00:00 2001 From: Danswar <48102227+Danswar@users.noreply.github.com> Date: Sat, 23 Aug 2025 13:29:34 -0300 Subject: [PATCH 1/3] [NO-TASK]: Only mints from positions (#61) --- ecosystem/ecosystem.minter.service.ts | 4 ++-- socialmedia/socialmedia.service.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ecosystem/ecosystem.minter.service.ts b/ecosystem/ecosystem.minter.service.ts index edbf357..15808e1 100644 --- a/ecosystem/ecosystem.minter.service.ts +++ b/ecosystem/ecosystem.minter.service.ts @@ -86,14 +86,14 @@ export class EcosystemMinterService { return list; } - async getRecentMints(timestamp: Date, minValue: bigint): Promise { + async getRecentMintsFromPositions(timestamp: Date, minValue: bigint): Promise { const checkTimestamp = Math.trunc(timestamp.getTime() / 1000); const mintsFetched = await PONDER_CLIENT.query({ fetchPolicy: 'no-cache', query: gql` query { - mints( + positionMints( orderBy: "timestamp", orderDirection: "desc" where: { timestamp_gt: "${checkTimestamp}" diff --git a/socialmedia/socialmedia.service.ts b/socialmedia/socialmedia.service.ts index 61adead..2dd8a84 100644 --- a/socialmedia/socialmedia.service.ts +++ b/socialmedia/socialmedia.service.ts @@ -169,7 +169,7 @@ export class SocialMediaService { const checkDate = new Date(this.socialMediaState.mintUpdates); const minAmount = BigInt(MIN_MINTING_AMOUNT * 10 ** 18); - const requestedMints = await this.mints.getRecentMints(checkDate, minAmount); + const requestedMints = await this.mints.getRecentMintsFromPositions(checkDate, minAmount); if (requestedMints.length > 0) { this.socialMediaState.mintUpdates = Date.now(); From e07022ec708881481dc49f6c5f9a7565da430371 Mon Sep 17 00:00:00 2001 From: Daniel Padrino Date: Sat, 23 Aug 2025 13:35:11 -0300 Subject: [PATCH 2/3] [NO-TASK]: Fix Position mints query --- ecosystem/ecosystem.minter.service.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ecosystem/ecosystem.minter.service.ts b/ecosystem/ecosystem.minter.service.ts index 15808e1..1272ba2 100644 --- a/ecosystem/ecosystem.minter.service.ts +++ b/ecosystem/ecosystem.minter.service.ts @@ -111,6 +111,6 @@ export class EcosystemMinterService { } `, }); - return mintsFetched?.data?.mints?.items ?? []; + return mintsFetched?.data?.positionMints?.items ?? []; } } From c0ce1c199170360f7aa8f7303489bca4e62575b4 Mon Sep 17 00:00:00 2001 From: TaprootFreak <142087526+TaprootFreak@users.noreply.github.com> Date: Wed, 27 Aug 2025 19:05:09 +0200 Subject: [PATCH 3/3] feat: Improve Ponder fallback mechanism with robust error handling (#62) * feat: Improve Ponder fallback mechanism with robust error handling - Add dynamic URI resolution for immediate fallback activation - Implement robust 503 detection checking multiple error structures - Add automatic retry mechanism using forward() for failed operations - Ensure all network errors trigger retry with fallback URL - Align implementation with proven dApp fallback strategy * [NO-TASK] improvements --------- Co-authored-by: lapatric <42653152+lapatric@users.noreply.github.com> --- api.apollo.config.ts | 37 ++++++++++++++++++++++--------------- 1 file changed, 22 insertions(+), 15 deletions(-) diff --git a/api.apollo.config.ts b/api.apollo.config.ts index 2d262bf..9f7198b 100644 --- a/api.apollo.config.ts +++ b/api.apollo.config.ts @@ -6,23 +6,22 @@ import { CONFIG } from './api.config'; const logger = new Logger('ApiApolloConfig'); -// Fallback URL management let fallbackUntil: number | null = null; function getIndexerUrl(): string { - if (fallbackUntil && Date.now() < fallbackUntil) return CONFIG.indexerFallback; - if (fallbackUntil) fallbackUntil = null; // Reset expired fallback - return CONFIG.indexer; + return fallbackUntil && Date.now() < fallbackUntil + ? CONFIG.indexerFallback + : CONFIG.indexer; } function activateFallback(): void { if (!fallbackUntil) { - fallbackUntil = Date.now() + 10 * 60 * 1000; // 10 minutes + fallbackUntil = Date.now() + 10 * 60 * 1000; logger.log(`[Ponder] Switching to fallback for 10min: ${CONFIG.indexerFallback}`); } } -const errorLink = onError(({ graphQLErrors, networkError, operation }) => { +const errorLink = onError(({ graphQLErrors, networkError, operation, forward }) => { if (graphQLErrors) { graphQLErrors.forEach((error) => { logger.error(`[GraphQL error in operation: ${operation?.operationName || 'unknown'}]`, { @@ -32,6 +31,7 @@ const errorLink = onError(({ graphQLErrors, networkError, operation }) => { }); }); } + if (networkError) { logger.error(`[Network error in operation: ${operation?.operationName || 'unknown'}]`, { message: networkError.message, @@ -39,28 +39,35 @@ const errorLink = onError(({ graphQLErrors, networkError, operation }) => { stack: networkError.stack, }); - // Activate fallback on network errors - if (getIndexerUrl() === CONFIG.indexer) activateFallback(); + if (getIndexerUrl() === CONFIG.indexer) { + const is503 = + (networkError as any)?.response?.status === 503 || + (networkError as any)?.statusCode === 503 || + (networkError as any)?.result?.status === 503; + + if (is503) { + logger.log('[Ponder] 503 Service Unavailable - Ponder is syncing, switching to fallback'); + } else { + logger.log('[Ponder] Network error detected, activating fallback'); + } + activateFallback(); + return forward(operation); + } } }); const httpLink = createHttpLink({ - uri: getIndexerUrl, + uri: () => getIndexerUrl(), fetch: (uri: RequestInfo | URL, options?: RequestInit) => { const controller = new AbortController(); const timeout = setTimeout(() => { controller.abort(); - }, 10000); // 10 second timeout + }, 10000); return fetch(uri, { ...options, signal: controller.signal, }) - .catch((error) => { - // Activate fallback on http errors - if (getIndexerUrl() === CONFIG.indexer) activateFallback(); - throw error; - }) .finally(() => { clearTimeout(timeout); });