Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

647 B
Raw Blame
import { RedisKeys } from '@/server/modules/Redis';

import { claimRedisOnce } from './cache';
import { getRedisServiceClient } from './client';

// Covers the 30 second scan timeout plus writeback. Claims expire rather than release early.
export const workspaceRescan = {
  async claim(scope: { cwd: string; deviceId: string; userId: string; workspaceId?: string }) {
    return claimRedisOnce(
      await getRedisServiceClient('sendPathCache'),
      RedisKeys.sendPathCache.workspaceRescanClaim(
        scope.userId,
        scope.workspaceId ?? 'personal',
        scope.deviceId,
        scope.cwd,
      ),
      45 * 1000,
    );
  },
};