fix: Remove server_epoch() from start_bas_executed Redis key
All checks were successful
BotServer CI / build (push) Successful in 2m49s
All checks were successful
BotServer CI / build (push) Successful in 2m49s
The epoch caused a new key to be created every second, bypassing the 'already executed' check and running start.bas multiple times, resulting in triplicated suggestions.
This commit is contained in:
parent
059ecb7187
commit
b83b4ffc4d
1 changed files with 2 additions and 2 deletions
|
|
@ -567,7 +567,7 @@ impl BotOrchestrator {
|
||||||
let actual_session_id = session.id.to_string();
|
let actual_session_id = session.id.to_string();
|
||||||
|
|
||||||
// Check if start.bas has already been executed for this session
|
// Check if start.bas has already been executed for this session
|
||||||
let start_bas_key = format!("start_bas_executed:{}:{}", server_epoch(), actual_session_id);
|
let start_bas_key = format!("start_bas_executed:{}", actual_session_id);
|
||||||
let should_execute_start_bas = if let Some(cache) = &self.state.cache {
|
let should_execute_start_bas = if let Some(cache) = &self.state.cache {
|
||||||
if let Ok(mut conn) = cache.get_multiplexed_async_connection().await {
|
if let Ok(mut conn) = cache.get_multiplexed_async_connection().await {
|
||||||
let executed: Result<Option<String>, redis::RedisError> = redis::cmd("GET")
|
let executed: Result<Option<String>, redis::RedisError> = redis::cmd("GET")
|
||||||
|
|
@ -1355,7 +1355,7 @@ async fn handle_websocket(
|
||||||
if let Some(bot_name) = bot_name_result {
|
if let Some(bot_name) = bot_name_result {
|
||||||
// Web clients expect start.bas to execute their first screen every time they connect/reload.
|
// Web clients expect start.bas to execute their first screen every time they connect/reload.
|
||||||
// We always run it, but we SET the start_bas_key flag right after so stream_response skips execution.
|
// We always run it, but we SET the start_bas_key flag right after so stream_response skips execution.
|
||||||
let start_bas_key = format!("start_bas_executed:{}:{}", server_epoch(), session_id);
|
let start_bas_key = format!("start_bas_executed:{}", session_id);
|
||||||
let should_execute_start_bas = true;
|
let should_execute_start_bas = true;
|
||||||
|
|
||||||
if should_execute_start_bas {
|
if should_execute_start_bas {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue