Skip to content

Commit 7c4e566

Browse files
committed
fix: Fix processing speed for docs with same priority
1 parent 5d7ab9b commit 7c4e566

3 files changed

Lines changed: 161 additions & 2 deletions

File tree

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,8 @@ dist/
99
target/
1010
Cargo.lock
1111

12+
# Private tooling (separate repos)
13+
tools/
14+
1215
# OS
1316
.DS_Store

apps/web/src/lib/pipeline.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -912,13 +912,13 @@ async function _processUser(userId: string, tier: Tier): Promise<number> {
912912

913913
if (activeDocs.length === 0) return 0
914914

915-
// Priority doc = pinned > active > normal, then oldest by createdAt
915+
// Priority doc = pinned > active (user-set); no createdAt tiebreak so
916+
// equal-priority docs compete fairly via virtual time.
916917
const PRIORITY_RANK: Record<string, number> = { pinned: 0, active: 1, normal: 2 }
917918
const priorityDocId = activeDocs.reduce((best, doc) => {
918919
const bestRank = PRIORITY_RANK[best.priority] ?? 2
919920
const docRank = PRIORITY_RANK[doc.priority] ?? 2
920921
if (docRank < bestRank) return doc
921-
if (docRank === bestRank && doc.createdAt! < best.createdAt!) return doc
922922
return best
923923
}).id
924924

pnpm-lock.yaml

Lines changed: 156 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)