File tree Expand file tree Collapse file tree 5 files changed +16
-35
lines changed Expand file tree Collapse file tree 5 files changed +16
-35
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ import { SemicircleMeter } from "../SemicircleMeter";
4545import { TabPanel , TabRoot , Tabs } from "../Tabs" ;
4646import { TokenIcon } from "../TokenIcon" ;
4747import { OisApyHistory } from "./ois-apy-history" ;
48+ import { getPublisherAverageScoreHistory , getPublisherRankingHistory } from '../../services/clickhouse' ;
4849
4950type 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
Original file line number Diff line number Diff line change @@ -63,27 +63,20 @@ export const ENABLE_ACCESSIBILITY_REPORTING =
6363let redisClient : Redis | undefined ;
6464
6565export 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
8477export 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 ! } ` ;
Original file line number Diff line number Diff line change @@ -19,14 +19,10 @@ export const getPublishersCached = redisCache.define(
1919
2020export 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
2725export 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
Original file line number Diff line number Diff line change @@ -183,8 +183,7 @@ export const getYesterdaysPrices = async (symbols: string[]) =>
183183 ) ;
184184
185185export 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
290289export const getPublisherAverageScoreHistory = async (
291- cluster : Cluster ,
292- key : string ,
290+ { cluster, key } : { cluster : Cluster ; key : string }
293291) =>
294292 safeQuery (
295293 z . array (
Original file line number Diff line number Diff line change 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" : {
You can’t perform that action at this time.
0 commit comments