Commit f711903
Fix atomic latest version update to prevent missing isLatest flags
Previously, updating the old latest version and creating the new version
were separate operations that could fail independently, potentially leaving
no version marked as isLatest. This change makes the operation atomic:
- CreateServer now accepts oldLatestVersionID parameter
- PostgreSQL implementation uses a transaction for UPDATE + INSERT atomicity
- Service layer maintains WithPublishLock for concurrent operation serialization
- Both mechanisms work together: lock prevents races, transaction ensures atomicity
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <[email protected]>1 parent ddcc586 commit f711903
File tree
4 files changed
+50
-28
lines changed- internal
- database
- importer
- service
4 files changed
+50
-28
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
44 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
45 | 47 | | |
46 | 48 | | |
47 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
328 | 328 | | |
329 | 329 | | |
330 | 330 | | |
331 | | - | |
332 | | - | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
333 | 334 | | |
334 | 335 | | |
335 | 336 | | |
| |||
346 | 347 | | |
347 | 348 | | |
348 | 349 | | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
| 361 | + | |
| 362 | + | |
| 363 | + | |
| 364 | + | |
| 365 | + | |
| 366 | + | |
| 367 | + | |
| 368 | + | |
| 369 | + | |
| 370 | + | |
| 371 | + | |
| 372 | + | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
349 | 376 | | |
350 | 377 | | |
351 | 378 | | |
352 | 379 | | |
353 | 380 | | |
354 | 381 | | |
355 | | - | |
356 | | - | |
| 382 | + | |
| 383 | + | |
357 | 384 | | |
358 | 385 | | |
359 | 386 | | |
360 | | - | |
361 | | - | |
| 387 | + | |
362 | 388 | | |
363 | 389 | | |
364 | 390 | | |
365 | 391 | | |
| 392 | + | |
| 393 | + | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
366 | 397 | | |
367 | 398 | | |
368 | 399 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
40 | | - | |
| 40 | + | |
41 | 41 | | |
42 | 42 | | |
43 | 43 | | |
| |||
181 | 181 | | |
182 | 182 | | |
183 | 183 | | |
184 | | - | |
| 184 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
176 | 176 | | |
177 | 177 | | |
178 | 178 | | |
179 | | - | |
180 | | - | |
| 179 | + | |
| 180 | + | |
181 | 181 | | |
182 | | - | |
183 | 182 | | |
184 | | - | |
185 | | - | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
191 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
192 | 186 | | |
193 | 187 | | |
194 | 188 | | |
195 | 189 | | |
196 | 190 | | |
197 | 191 | | |
198 | 192 | | |
199 | | - | |
200 | | - | |
201 | | - | |
202 | | - | |
203 | | - | |
204 | | - | |
205 | | - | |
| 193 | + | |
| 194 | + | |
206 | 195 | | |
207 | 196 | | |
208 | 197 | | |
| |||
0 commit comments