mirror of
https://github.com/stablyai/orca.git
synced 2026-09-22 16:02:32 +00:00
perf: cap usage worktree canonicalization (#4263)
This commit is contained in:
@@ -6,6 +6,7 @@ import { isAbsolute, join, posix, win32 } from 'path'
|
||||
import type { Repo } from '../../shared/types'
|
||||
import { areWorktreePathsEqual } from '../ipc/worktree-logic'
|
||||
import Database from '../sqlite/sync-database'
|
||||
import { canonicalizeUsageWorktreePaths } from '../usage-worktree-canonicalizer'
|
||||
import type {
|
||||
OpenCodeUsageAttributedEvent,
|
||||
OpenCodeUsageDailyAggregate,
|
||||
@@ -441,13 +442,7 @@ function isContainingPath(candidatePath: string, targetPath: string): boolean {
|
||||
async function buildWorktreesWithCanonicalPaths(
|
||||
worktrees: OpenCodeUsageWorktreeRef[]
|
||||
): Promise<(OpenCodeUsageWorktreeRef & { canonicalPath: string })[]> {
|
||||
const canonicalized = await Promise.all(
|
||||
worktrees.map(async (worktree) => ({
|
||||
...worktree,
|
||||
canonicalPath: await canonicalizePath(worktree.path)
|
||||
}))
|
||||
)
|
||||
return canonicalized.sort((left, right) => right.canonicalPath.length - left.canonicalPath.length)
|
||||
return canonicalizeUsageWorktreePaths(worktrees, canonicalizePath)
|
||||
}
|
||||
|
||||
async function canonicalizePath(pathValue: string): Promise<string> {
|
||||
|
||||
Reference in New Issue
Block a user