Commit cf21bea
committed
Derive default-catalog product ids deterministically (issue #34)
build_static_product_catalog minted prod-{uuid4} ids per process, so any
multi-worker deployment (the shipped Dockerfile runs uvicorn --workers 2)
or a restart between GET /products and GET /products/{id} could 404 on an
id the server itself had just returned. This is the surviving kernel of
issue #34 observation 1; the CSV-mode side was fixed in v2.2.2.
Derive ids with uuid5 over the config name instead: same prod-[0-9a-f]{8}
shape, unique per product, identical in every process. Adds a regression
test that rebuilds the catalog after a cache reset (the single-process
proxy for a second worker) and asserts the id set is unchanged.1 parent 62803d4 commit cf21bea
2 files changed
Lines changed: 16 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
392 | 392 | | |
393 | 393 | | |
394 | 394 | | |
395 | | - | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
396 | 399 | | |
397 | 400 | | |
398 | 401 | | |
399 | | - | |
| 402 | + | |
| 403 | + | |
400 | 404 | | |
401 | 405 | | |
402 | 406 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
215 | 215 | | |
216 | 216 | | |
217 | 217 | | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
| 226 | + | |
| 227 | + | |
218 | 228 | | |
219 | 229 | | |
220 | 230 | | |
| |||
0 commit comments