// import { redlock } from './redis.provider';

// export async function runWithDistributedLock(
//     key: string,
//     ttl: number,
//     task: () => Promise<void>,
// ): Promise<void> {
//     console.log(`🚦 Attempting to acquire lock: ${key} with TTL: ${ttl}`);
//     try {
//         const lock = await redlock.acquire([`locks:${key}`], ttl);
//         console.log(`🔒 Lock acquired: ${key}`);
//         await task();
//         await lock.release();
//         console.log(`🔓 Lock released: ${key}`);
//     } catch (err) {
//         console.warn(`⛔ Lock not acquired for ${key}:`, err?.message);
//     }
// }
