Commit graph

4 commits

Author SHA1 Message Date
snider
0735445eb0 fix: Address code review issues and fix miner start deadlock
- Remove deprecated GetDB() function that exposed raw DB pointer
- Fix GetLatestHashrate to distinguish sql.ErrNoRows from real errors
- Document async saves in PeerRegistry mutation methods
- Fix deadlock in XMRig/TTMiner Start() by moving CheckInstallation
  call before acquiring the main lock (Go RWMutex doesn't allow
  recursive locking)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 03:51:05 +00:00
snider
b24a3f00d6 fix: Add timeouts, atomic writes, and thread safety improvements
- Add 30s context timeout for database transactions in hashrate.go
- Add helper function for parsing SQLite timestamps with error logging
- Implement atomic file writes (temp + rename) for profile_manager.go,
  config_manager.go, and peer.go to prevent corruption on crash
- Add 5s timeout for stats collection per miner in manager.go
- Add 5s timeout for stdin writes in miner.go
- Clean up config file on failed miner start in xmrig_start.go
- Implement debounced saves (5s) for peer registry to reduce disk I/O
- Fix CheckInstallation data race in xmrig.go and ttminer.go by adding
  proper mutex protection around shared field updates
- Add 10s handshake timeout for WebSocket connections in transport.go
- Update peer_test.go to call Close() before reload to flush changes

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 02:55:30 +00:00
snider
8b5d446ffe fix: Complete race condition fixes and add config synchronization
- Add sync.RWMutex to config_manager.go for file operation synchronization
- Add deprecation warning to unsafe GetDB() function in database.go
- Fix UninstallMiner map modification during iteration in manager.go
- Add server readiness verification via TCP dial in service.go
- Add mutex-protected httpClient getter/setter in xmrig.go
- Update GetLatestVersion to use synchronized HTTP client in ttminer.go
- Update MockMiner in service_test.go to match context-aware GetStats interface

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-31 02:02:57 +00:00
snider
e0c9c92244 feat: Implement logging functionality for miners with log buffer and retrieval endpoint 2025-12-29 22:10:45 +00:00