mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-04 10:24:02 +00:00
fix(osm): gate place search cross-site and share its slots fairly
From review: - /api/osm/features now refuses cross-site browser requests like the other quota-bearing routes, so a page elsewhere cannot spend the operator's Overpass. SECURITY.md lists the route, its limits and its disk cache. - One client runs one search at a time and two run at once in all, instead of one global slot any single client could hold. - A search gets 45 s across every configured endpoint in turn, answered 504 when it runs out. - A cache write no longer waits on the disk prune; prune() waits until the cache is idle for callers that need it.
This commit is contained in:
1 parent
0b6cdc8e1f
commit
fb74354d30
6 files changed
+156
-27
No files matched your search
@@ -121,9 +121,15 @@ export function createBoundedCache({
|
||||
} catch {
|
||||
return;
|
||||
}
|
||||
await schedulePrune();
|
||||
// In the background: an answer never waits on a 400-file directory scan.
|
||||
// `prune()` returns the pending pass for callers that need it done.
|
||||
schedulePrune();
|
||||
},
|
||||
/** Run a prune and wait until no pass is running or queued. */
|
||||
async prune() {
|
||||
schedulePrune();
|
||||
while (pruning) await pruning;
|
||||
},
|
||||
prune: schedulePrune,
|
||||
get memorySize() {
|
||||
return memory.size;
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user