Skip to content

Commit b684cbe

Browse files
committed
fix: publishers metadata
1 parent 9e29e54 commit b684cbe

File tree

5 files changed

+16
-35
lines changed

5 files changed

+16
-35
lines changed

apps/insights/src/components/Publisher/layout.tsx

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ import { SemicircleMeter } from "../SemicircleMeter";
4545
import { TabPanel, TabRoot, Tabs } from "../Tabs";
4646
import { TokenIcon } from "../TokenIcon";
4747
import { OisApyHistory } from "./ois-apy-history";
48+
import { getPublisherAverageScoreHistory, getPublisherRankingHistory } from '../../services/clickhouse';
4849

4950
type Props = {
5051
children: ReactNode;
@@ -150,10 +151,7 @@ const RankingCard = async ({
150151
cluster: Cluster;
151152
publisherKey: string;
152153
}) => {
153-
const rankingHistory = await getPublisherRankingHistoryCached(
154-
cluster,
155-
publisherKey,
156-
);
154+
const rankingHistory = await getPublisherRankingHistoryCached({ cluster, key: publisherKey });
157155
return <RankingCardImpl rankingHistory={rankingHistory} />;
158156
};
159157

@@ -234,10 +232,8 @@ const ScoreCard = async ({
234232
cluster: Cluster;
235233
publisherKey: string;
236234
}) => {
237-
const averageScoreHistory = await getPublisherAverageScoreHistoryCached(
238-
cluster,
239-
publisherKey,
240-
);
235+
const averageScoreHistory = await getPublisherAverageScoreHistoryCached({ cluster, key: publisherKey });
236+
241237
return <ScoreCardImpl averageScoreHistory={averageScoreHistory} />;
242238
};
243239

apps/insights/src/config/server.ts

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,27 +63,20 @@ export const ENABLE_ACCESSIBILITY_REPORTING =
6363
let redisClient: Redis | undefined;
6464

6565
export function getRedis(): Redis {
66-
const host = process.env.REDIS_HOST;
67-
const port = process.env.REDIS_PORT;
68-
const password = process.env.REDIS_PASSWORD;
69-
if (!host || !port) {
70-
throw new Error('REDIS_HOST, and REDIS_PORT must be set');
66+
const url = process.env.REDIS_URL;
67+
if (!url) {
68+
throw new Error('REDIS_URL must be set');
7169
}
7270
if(redisClient) {
7371
return redisClient;
7472
}
75-
redisClient = new Redis({
76-
username: 'default',
77-
password: password ?? '',
78-
host,
79-
port: Number.parseInt(port),
80-
});
73+
redisClient = new Redis(url);
8174
return redisClient;
8275
}
8376

8477
export const PUBLIC_URL = (() => {
8578
if (IS_PRODUCTION_SERVER) {
86-
79+
8780
return `https://${process.env.VERCEL_PROJECT_PRODUCTION_URL!}`;
8881
} else if (IS_PREVIEW_SERVER) {
8982
return `https://${process.env.VERCEL_URL!}`;

apps/insights/src/server/clickhouse.ts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -19,14 +19,10 @@ export const getPublishersCached = redisCache.define(
1919

2020
export const getPublisherAverageScoreHistoryCached = redisCache.define(
2121
"getPublisherAverageScoreHistory",
22-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
23-
// @ts-expect-error - The ACD cache lib does not have `define` correctly typed
24-
getPublisherAverageScoreHistory,
25-
).getPublisherAverageScoreHistory as typeof getPublisherAverageScoreHistory;
22+
getPublisherAverageScoreHistory
23+
).getPublisherAverageScoreHistory
2624

2725
export const getPublisherRankingHistoryCached = redisCache.define(
2826
"getPublisherRankingHistory",
29-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
30-
// @ts-expect-error - The ACD cache lib does not have `define` correctly typed
31-
getPublisherRankingHistory,
32-
).getPublisherRankingHistory as typeof getPublisherRankingHistory;
27+
getPublisherRankingHistory
28+
).getPublisherRankingHistory

apps/insights/src/services/clickhouse.ts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,8 +183,7 @@ export const getYesterdaysPrices = async (symbols: string[]) =>
183183
);
184184

185185
export const getPublisherRankingHistory = async (
186-
cluster: Cluster,
187-
key: string,
186+
{ cluster, key }: { cluster: Cluster; key: string }
188187
) =>
189188
safeQuery(
190189
z.array(
@@ -288,8 +287,7 @@ export const getFeedPriceHistory = async (
288287
);
289288

290289
export const getPublisherAverageScoreHistory = async (
291-
cluster: Cluster,
292-
key: string,
290+
{ cluster, key }: { cluster: Cluster; key: string }
293291
) =>
294292
safeQuery(
295293
z.array(

apps/insights/turbo.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@
1616
"DISABLE_ACCESSIBILITY_REPORTING",
1717
"NEXT_PUBLIC_PYTHNET_RPC",
1818
"NEXT_PUBLIC_PYTHTEST_CONFORMANCE_RPC",
19-
"REDIS_HOST",
20-
"REDIS_PORT",
21-
"REDIS_PASSWORD"
19+
"REDIS_URL"
2220
]
2321
},
2422
"fix:lint": {

0 commit comments

Comments
 (0)