Skip to content

Commit

Permalink
Turn off polling of non-priority feeds
Browse files Browse the repository at this point in the history
  • Loading branch information
robknight committed Nov 12, 2024
1 parent 5ac3788 commit 91199cf
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 5 deletions.
3 changes: 3 additions & 0 deletions apps/passport-client/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ DISABLE_CONSOLE_LOG=

# Some origins are allowed to query Devcon tickets directly. Origins not in this list cannot do so:
DEVCON_TICKET_QUERY_ORIGINS='["http://example.com", "http://localhost:3200"]'

# If IGNORE_NON_PRIORITY_FEEDS=true, then non-priority feeds will be ignored.
IGNORE_NON_PRIORITY_FEEDS=false
7 changes: 7 additions & 0 deletions apps/passport-client/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,13 @@ const define = {
process.env.DEVCON_TICKET_QUERY_ORIGINS
)
}
: {}),
...(process.env.IGNORE_NON_PRIORITY_FEEDS !== undefined
? {
"process.env.IGNORE_NON_PRIORITY_FEEDS": JSON.stringify(
process.env.IGNORE_NON_PRIORITY_FEEDS
)
}
: {})
};

Expand Down
5 changes: 4 additions & 1 deletion apps/passport-client/src/appConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ interface AppConfig {
embeddedZapps: Record<string, string>;
// origins that are allowed to query Devcon tickets directly
devconTicketQueryOrigins: string[];
// If IGNORE_NON_PRIORITY_FEEDS=true, then non-priority feeds will be ignored.
ignoreNonPriorityFeeds: boolean;
}

if (
Expand Down Expand Up @@ -84,7 +86,8 @@ export const appConfig: AppConfig = {
zappRestrictOrigins: process.env.ZAPP_RESTRICT_ORIGINS === "true",
zappAllowedSignerOrigins: zappAllowedSignerOrigins,
embeddedZapps: embeddedZapps,
devconTicketQueryOrigins: devconTicketQueryOrigins
devconTicketQueryOrigins: devconTicketQueryOrigins,
ignoreNonPriorityFeeds: process.env.IGNORE_NON_PRIORITY_FEEDS === "true"
};

console.log("App Config: " + JSON.stringify(appConfig));
21 changes: 17 additions & 4 deletions apps/passport-client/src/dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1160,14 +1160,27 @@ async function doSync(
onSubscriptionResult,
state.subscriptions
.getActiveSubscriptions()
.filter(
(s) =>
s.id !==
.filter((s) => {
if (
s.id ===
state.subscriptions.findSubscription(
ZUPASS_FEED_URL,
ZupassFeedIds.Email
)?.id
)
) {
return false;
}

if (appConfig.ignoreNonPriorityFeeds) {
// Check if this is the Devcon ticket feed
return (
s.providerUrl ===
"https://podbox-server.onrender.com/generic-issuance/api/feed/7dbd164b-3a50-4410-a815-d6e05b8c7107/default-feed"
);
}

return true;
})
.map((s) => s.id)
);

Expand Down
1 change: 1 addition & 0 deletions turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@
"DEVCON_TICKET_QUERY_ORIGINS",
"GENERATED_CHUNKS",
"TELEGRAM_CHAT_TO_PRODUCT_IDS",
"IGNORE_NON_PRIORITY_FEEDS",
"//// add env vars above this line ////"
],
"globalEnv": [
Expand Down

0 comments on commit 91199cf

Please sign in to comment.