fix: prevent race conditions during vault index rebuild and rate-limit embeddings
- Add AbortController to cancel ongoing indexing before clear/rebuild - Track currentIndexingPromise to await cancellation before clearing collection - Batch background indexing (5 files at a time) with 100ms delays between batches - Skip incremental event-based indexing while a full rebuild is in progress - Cancel indexing on plugin unload - Fix nginx CORS headers on OPTIONS preflight responses
This commit is contained in:
+4
-1
@@ -8,7 +8,7 @@ http {
|
||||
server_name localhost;
|
||||
|
||||
location / {
|
||||
# CORS headers for every response (including 4xx/5xx from upstream)
|
||||
# CORS headers must be set for every response, including OPTIONS preflight
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
|
||||
@@ -16,6 +16,9 @@ http {
|
||||
|
||||
# Preflight OPTIONS
|
||||
if ($request_method = 'OPTIONS') {
|
||||
add_header 'Access-Control-Allow-Origin' '*' always;
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, DELETE, OPTIONS' always;
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range,Authorization' always;
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
add_header 'Content-Type' 'text/plain; charset=utf-8';
|
||||
add_header 'Content-Length' 0;
|
||||
|
||||
Reference in New Issue
Block a user