Skip to content

Commit

Permalink
Revert "Revert "Turn off polling of non-priority feeds (#2167)" (#2170)"
Browse files Browse the repository at this point in the history
This reverts commit de3bd2e.
  • Loading branch information
rrrliu committed Nov 13, 2024
1 parent de3bd2e commit e37dd16
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 5 deletions.
6 changes: 6 additions & 0 deletions apps/passport-client/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,9 @@ 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

# URLs of feed providers that are priority feeds.
PRIORITY_FEED_PROVIDER_URLS='[]'
14 changes: 14 additions & 0 deletions apps/passport-client/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,20 @@ 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
)
}
: {}),
...(process.env.PRIORITY_FEED_PROVIDER_URLS !== undefined
? {
"process.env.PRIORITY_FEED_PROVIDER_URLS": JSON.stringify(
process.env.PRIORITY_FEED_PROVIDER_URLS
)
}
: {})
};

Expand Down
10 changes: 9 additions & 1 deletion apps/passport-client/src/appConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ 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;
// URLs of feed providers that are priority feeds.
priorityFeedProviderUrls: string[];
}

if (
Expand Down Expand Up @@ -84,7 +88,11 @@ 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",
priorityFeedProviderUrls: process.env.PRIORITY_FEED_PROVIDER_URLS
? JSON.parse(process.env.PRIORITY_FEED_PROVIDER_URLS)
: []
};

console.log("App Config: " + JSON.stringify(appConfig));
17 changes: 13 additions & 4 deletions apps/passport-client/src/dispatch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1160,14 +1160,23 @@ 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) {
return appConfig.priorityFeedProviderUrls.includes(s.providerUrl);
}

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

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

0 comments on commit e37dd16

Please sign in to comment.