diff --git a/pages/index.tsx b/pages/index.tsx index 0edf500..c6fff71 100644 --- a/pages/index.tsx +++ b/pages/index.tsx @@ -98,7 +98,10 @@ export default function Home({ userCount }: { userCount: number }) { } export async function getServerSideProps(ctx: any) { - let userCount = await axios.get("https://lanyard.cnrad.dev/api/getUserCount").then(res => res.data.count); + let userCount = await axios + .get("https://lanyard.cnrad.dev/api/getUserCount", { timeout: 1000 }) + .then(res => res.data.count) + .catch(() => 0); return { props: { userCount }, diff --git a/src/redis.ts b/src/redis.ts index 106b727..10c47c9 100644 --- a/src/redis.ts +++ b/src/redis.ts @@ -1,5 +1,9 @@ import Redis from "ioredis"; -const redis = new Redis(process.env.REDIS_URL); +const redis = new Redis(process.env.REDIS_URL, { + connectTimeout: 1000, + lazyConnect: false, + maxRetriesPerRequest: 1, +}); export default redis;