Skip to content

Commit fe1c91f

Browse files
fix(file-search): increase indexing worker memory (#7963)
1 parent b0a68f2 commit fe1c91f

3 files changed

Lines changed: 4 additions & 2 deletions

File tree

‎apps/sim/background/workspace-file-search-index.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ describe('workspace file search index task', () => {
3535
it('uses isolated medium workers with a hard global concurrency and duration cap', () => {
3636
expect(workspaceFileSearchIndexTask).toMatchObject({
3737
id: 'workspace-file-search-index',
38-
machine: 'medium-1x',
38+
machine: 'medium-2x',
3939
maxDuration: FILE_SEARCH_INDEX_MAX_DURATION_SECONDS,
4040
retry: { maxAttempts: 3 },
4141
queue: {

‎apps/sim/background/workspace-file-search-index.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import {
1515
*/
1616
export const workspaceFileSearchIndexTask = task({
1717
id: 'workspace-file-search-index',
18-
machine: 'medium-1x',
18+
machine: 'medium-2x',
1919
maxDuration: FILE_SEARCH_INDEX_MAX_DURATION_SECONDS,
2020
retry: { maxAttempts: 3 },
2121
queue: {

‎apps/sim/lib/workspace-files/search/README.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ PostgreSQL stores complete extracted text in bounded chunks. Object storage rema
1212

1313
Workers download and extract outside database transactions, then insert batches of at most 250 rows / 1 MiB. Each batch checks the build token and lease. Publication locks the canonical file, build, and revision in that order, verifies the stored chunk count, and changes the visible pointer only after every batch succeeds. Old dispatch failure callbacks cannot overwrite newer dispatches or successful builds.
1414

15+
The indexing task uses an isolated `medium-2x` Trigger worker (4 GB RAM). Document parsers can materialize expanded content before chunking, so source and extracted-text byte limits do not bound parser memory. Parser complexity guards and the worker's memory budget remain separate protections.
16+
1517
File edits, context changes, and deletion invalidate metadata and expire builds. Chunks have no cascading foreign key to files or workspaces. Cleanup locks at most 100 expired builds with `SKIP LOCKED`, deletes at most 1,000 chunks per transaction, retires empty builds in the same batch, and stops after 10 batches or five seconds. Dispatch pauses while at least 10,000 expired chunks await cleanup, so sustained revisions cannot keep admitting new builds faster than retirement can drain them. Existing ready files remain searchable. Stale workers cannot revive a reclaimed build.
1618

1719
## Search

0 commit comments

Comments
 (0)