acmpesuecc / acmpesuecc/KissanDial
Fix Global Variable Thread-Safety Issue
- Dominant language
- Python
- Stars
- 0
- Forks
- 10
- PR merge metrics
- No merged PRs in 30d
Description
## **Description**
The application uses a global variable `to_say` that's modified across multiple endpoints. When multiple farmers call simultaneously, their responses get mixed up because all calls share the same global variable. This is a critical production bug.
## **Example of the Problem:**
```
Farmer A calls: "Tell me about PM-KISAN"
Farmer B calls: "Weather forecast please"
Agent sets to_say = "PM-KISAN gives Rs. 6000..."
Agent sets to_say = "Today's weather is sunny..." (overwrites!)
Farmer A hears: "Today's weather is sunny..." ❌ (Wrong response!)
```
## **What needs to be done:**
- Remove the global `to_say` variable
- Implement session-based conversation storage using Flask sessions
- Store conversation state per Call SID (unique for each call)
- Update both `/voice` and `/handle-speech` endpoints
- Test with concurrent calls (simulate using multiple requests)
Contributor guide
Assessment
This issue has not been assessed yet.