Commit 767eb23
fix(api): remove trader from memory map after deletion
## Problem
After deleting a trader, the competition API still returns the deleted trader because:
- Database deletion succeeds
- But TraderManager.traders map still contains the trader
- GetCompetitionData() iterates over tm.traders map (includes deleted ones)
## Solution
Add RemoveTrader() method to TraderManager:
- Stop the trader if running
- Remove from traders map
- Simplified version (no competitionCache, z-dev doesn't have it)
## Changes
- Add manager/trader_manager.go::RemoveTrader()
- Update api/server.go::handleDeleteTrader() to call RemoveTrader()
## Comparison with PR NoFxAiOS#622
- PR NoFxAiOS#622: Full version with competitionCache clearing
- Ours: Simplified for z-dev (no competitionCache yet)
- Both solve the same core problem
- Ours is compatible with current z-dev architecture
## Related
- Inspired by PR NoFxAiOS#622 @songzhihui
- Complements frontend fix (commit 685f248)
- Frontend: instant UI updates
- Backend: correct data source
🤖 Generated with Claude Code
Co-Authored-By: Claude <[email protected]>1 parent 685f248 commit 767eb23
2 files changed
+29
-7
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
616 | 616 | | |
617 | 617 | | |
618 | 618 | | |
619 | | - | |
620 | | - | |
621 | | - | |
622 | | - | |
623 | | - | |
624 | | - | |
625 | | - | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
626 | 623 | | |
627 | 624 | | |
628 | 625 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
437 | 437 | | |
438 | 438 | | |
439 | 439 | | |
| 440 | + | |
| 441 | + | |
| 442 | + | |
| 443 | + | |
| 444 | + | |
| 445 | + | |
| 446 | + | |
| 447 | + | |
| 448 | + | |
| 449 | + | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
| 461 | + | |
| 462 | + | |
| 463 | + | |
| 464 | + | |
440 | 465 | | |
441 | 466 | | |
442 | 467 | | |
| |||
0 commit comments