Skip to content

Commit

Permalink
Merge pull request #2900 from KukretiShubham/redis-cli
Browse files Browse the repository at this point in the history
fix: redis client max reach bug on passport page
  • Loading branch information
KukretiShubham authored Nov 14, 2024
2 parents b9f625c + 0f210ca commit 116f6ee
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/pages/api/authenticate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const POST = async ({ request }: { request: Request }) => {
const res = whenNotError(authenticated, (_auth) =>
_auth ? _auth : new Error('Unauthorized'),
)

await client.quit()
return isNotError(res)
? new Response(
json({
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/clubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export const GET: APIRoute = async ({ url }): Promise<Response> => {
),
),
)) ?? []

await client.quit()
return new Response(JSON.stringify(res), {
status: 200,
headers: { ...headers, ...cache({ maxAge: 604800 }) },
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/decrypt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export const POST = async ({ request }: { request: Request }) => {
}

let decoded = jsonwebtoken.verify(encryptedText, process.env.SALT ?? '')

await client.quit()
return new Response(
JSON.stringify({
decoded,
Expand Down
2 changes: 1 addition & 1 deletion src/pages/api/fetchClubs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export const POST = async ({ request }: { request: Request }) => {
configs.push(decode(config))
}

await client.disconnect()
await client.quit()

return new Response(JSON.stringify(configs), { status: 200 })
}
1 change: 1 addition & 0 deletions src/pages/api/plugins/addPluginToClub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export const POST = async ({ request }: { request: Request }) => {
await client.quit()
return new Response(JSON.stringify({}), { status: 200 })
} catch (error) {
await client.quit()
return new Response(JSON.stringify({ error }), { status: 500 })
}
}
1 change: 1 addition & 0 deletions src/pages/api/profile/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ export const POST = async ({ request }: { request: Request }) => {
await client.quit()
return new Response(JSON.stringify({}), { status: 200 })
} catch (error) {
await client.quit()
return new Response(JSON.stringify({ error }), { status: 500 })
}
}
3 changes: 2 additions & 1 deletion src/pages/api/profile/updateLike.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,10 +82,11 @@ export const POST = async ({ request }: { request: Request }) => {

try {
await client.set(profileIdForDB, JSON.stringify(newProfile))
await client.quit()
} catch (error) {
await client.quit()
return new Response(JSON.stringify({ error }), { status: 500 })
}

await client.quit()
return new Response(JSON.stringify({}), { status: 200 })
}

0 comments on commit 116f6ee

Please sign in to comment.