acmpesuecc / acmpesuecc/KissanDial

Fix Global Variable Thread-Safety Issue

Open
#4 41 comments 0 reactions 1 assignee Claimed by @Prathik-Kharat View on GitHub
bounty 400 enhancement hacknight-2025 hacktoberfest
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.