# Eager background indexing \(\#2928\) · gitcafe/zed

[View on GitCafe](https://git.cafe/gitcafe/zed/commit/49af2874bb9e4db1a4b70641034f02b0c6a1fc8b)

Repository: [gitcafe/zed](https://git.cafe/gitcafe/zed)

Visibility: public

Requested revision: 49af2874bb9e4db1a4b70641034f02b0c6a1fc8b

Requested commit: 49af2874bb9e4db1a4b70641034f02b0c6a1fc8b

Commit: 49af2874bb9e4db1a4b70641034f02b0c6a1fc8b

Tree: df1c5a8c0869ffc5e33775a19a0f035711573f97

Author: Kyle Caverly

Committer: GitHub

## Message

```
Eager background indexing (#2928)

This PR ships a series of optimizations for the semantic search engine.
Mostly focused on removing invalid states, optimizing requests to
OpenAI, and reducing token usage.

Release Notes (Preview-Only):

- Added eager incremental indexing in the background on a debounce.
- Added a local embeddings cache for reducing redundant calls to OpenAI.
- Moved to an Embeddings Queue model which ensures optimal batch sizes
at the token level, and atomic file & document writes.
- Adjusted OpenAI Embedding API requests to use provided backoff delays
during Rate Limiting.
- Removed flush races between parsing files step and embedding queue
steps.
- Moved truncation to parsing step reducing the probability that OpenAI
encounters bad data.
```

## Parents

- [c2c04616b4fe0896d394a0031defb94cff1821ed](https://git.cafe/gitcafe/zed/commit/c2c04616b4fe0896d394a0031defb94cff1821ed?format=markdown)

- [8dbc0fe0333958d6057a99bb734700deb270bf8b](https://git.cafe/gitcafe/zed/commit/8dbc0fe0333958d6057a99bb734700deb270bf8b?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zed/tree/49af2874bb9e4db1a4b70641034f02b0c6a1fc8b?format=markdown)
