bee
bee copied to clipboard
Running only one sampling process
Summary
Implement synchronization mechanism to ensure only one sampling process runs at a time in agent.go, and prevent concurrent calls to rchash endpoint which can cause race conditions and inconsistent state.
Motivation
Currently, multiple sampling processes can be triggered concurrently, leading to:
- Race conditions in the agent.go module
- Inconsistent state when multiple processes try to access and modify the same resources
- Performance degradation and increased error rates when rchash endpoint is called simultaneously
- Potential deadlocks or system instability under high load
Implementation
Potential implementation approaches: Add a mutex lock around the sampling process in agent.go