Conversation
…e-optimization improved dev perf
moved rag feature to lib/tool
Adding dotenv to detect env
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e3dc4a9e3d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| return runDocIngestionTool({ | ||
| ...eventData, | ||
| runtime: { | ||
| updateJobStatus: false, | ||
| markFailureInDb: false, |
There was a problem hiding this comment.
Throw on failed ingestion so Inngest retries execute
This function is configured with retries: 5, but it now directly returns runDocIngestionTool(...), which catches internal errors and returns { success: false } instead of throwing (see src/lib/tools/doc-ingestion/index.ts catch path). In failure scenarios like sidecar/embed outages or DB write errors, Inngest will treat the run as successful, so retries and onFailure handling are skipped and the document pipeline can silently stop without recovery.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e3dc4a9e3d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (cached.expiresAt < Date.now()) { | ||
| middlewareUserCache.delete(userId); | ||
| return undefined; |
There was a problem hiding this comment.
Evict expired middleware cache entries proactively
This cache currently removes stale entries only when the same userId is requested again, so users who do not return after their first hit remain in memory indefinitely. In a long-lived Node middleware process, each distinct verified user adds a retained map entry, which can cause unbounded memory growth over time; add periodic cleanup or size-bounded eviction so expired entries are removed even without future lookups.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: e3dc4a9e3d
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| const cachedUser = getCachedMiddlewareUser(userId); | ||
| let existingUser = cachedUser; | ||
| if (cachedUser === undefined) { |
There was a problem hiding this comment.
Recheck role/status before authorizing protected routes
This middleware now trusts a cached user record before hitting the database, so role/status changes are not enforced until the 10s TTL expires. If an admin demotes a user or marks them unverified, requests during that window are still authorized using stale role/status and can continue through protected /employer or /employee paths. Previously each request re-read the DB, so revocations took effect immediately.
Useful? React with 👍 / 👎.
| import { drizzle } from "drizzle-orm/postgres-js"; | ||
|
|
||
| // Lightweight db client for hot API routes that do not need schema-wide typing. | ||
| const coreClient = postgres(process.env.DATABASE_URL!, { max: 10 }); |
There was a problem hiding this comment.
Reuse the existing Postgres pool for core DB access
This introduces a second postgres() pool (max: 10) even though src/server/db/index.ts already creates its own max: 10 pool. In long-lived Next.js server processes that load both modules, connection usage doubles per process and can hit database connection limits under traffic. Reusing a shared client/pool avoids unnecessary connection pressure.
Useful? React with 👍 / 👎.
No description provided.