···33 NodeSavedSession,
44 NodeSavedState,
55 RuntimeLock,
66- Session,
76} from "@atproto/oauth-client-node";
87import { JoseKey } from "@atproto/jwk-jose";
98import { oauth_metadata } from "app/api/oauth/[route]/oauth-metadata";
109import { supabaseServerClient } from "supabase/serverClient";
11101212-import { Redis } from "@upstash/redis";
1111+import Client from "ioredis";
1312import Redlock from "redlock";
1413export async function createOauthClient() {
1514 let keyset =
···1918 ])
2019 : undefined;
2120 let requestLock: RuntimeLock | undefined;
2222- if (
2323- process.env.NODE_ENV === "production" &&
2424- process.env.KV_REST_API_URL &&
2525- process.env.KV_REST_API_TOKEN
2626- ) {
2727- const redis = new Redis({
2828- url: process.env.KV_REST_API_URL,
2929- token: process.env.KV_REST_API_TOKEN,
3030- });
3131- const redlock = new Redlock([redis]);
2121+ if (process.env.NODE_ENV === "production" && process.env.REDIS_URL) {
2222+ const client = new Client(process.env.REDIS_URL);
2323+ const redlock = new Redlock([client]);
3224 requestLock = async (key, fn) => {
3325 // 30 seconds should be enough. Since we will be using one lock per user id
3426 // we can be quite liberal with the lock duration here.