From 5e5ba0e8f5d5ee0b95da1348201bd773168d8624 Mon Sep 17 00:00:00 2001 From: Randall-Jiang Date: Wed, 15 Jan 2025 22:28:16 -0800 Subject: [PATCH] telemetry(AmazonQ) ProgrammingLanguage is unknown (#5267) * telemetry: fix the unknown language issue * telemetry fix the unknown language issue and remove the wrong print --- .../amazonqCodeTest/storage/ChatSessionStorage.kt | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/storage/ChatSessionStorage.kt b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/storage/ChatSessionStorage.kt index 0a9a782ecb..0e38f06c6d 100644 --- a/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/storage/ChatSessionStorage.kt +++ b/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqCodeTest/storage/ChatSessionStorage.kt @@ -8,13 +8,8 @@ import software.aws.toolkits.jetbrains.services.amazonqCodeTest.session.Session class ChatSessionStorage { private val sessions = mutableMapOf() - private fun createSession(tabId: String): Session { - val session = Session(tabId) - sessions[tabId] = session - return session - } - - fun getSession(tabId: String): Session = sessions[tabId] ?: createSession(tabId) + @Synchronized + fun getSession(tabId: String): Session = sessions.getOrPut(tabId) { Session(tabId) } fun deleteSession(tabId: String) { sessions.remove(tabId)