Commit 1bdd6ca
authored
fix(amazonqFeatureDev): race conditions on session creation aws#4724
Problem:
When a customer starts a /dev chat with a message, e.g. /dev <do something>, the
connector logic calls two event handlers in amazonqFeatureDev logic parallely
that try to create a session, this creates a race condition where the customer
could get to code generation with the wrong session, i.e. one with no
conversationId.
Solution:
Lock the getSession function to mitigate concurrent calls.
This is a similar approach to the one taken in JetBrain's toolkit:
https://github.com/aws/aws-toolkit-jetbrains/blob/ec168fc6e9306f22f07945fd516d6acdc7fe396e/plugins/amazonq/chat/jetbrains-community/src/software/aws/toolkits/jetbrains/services/amazonqFeatureDev/storage/ChatSessionStorage.kt#L181 parent 26cd09e commit 1bdd6ca
File tree
2 files changed
+42
-6
lines changed- packages/core/src
- amazonqFeatureDev/storages
- test/amazonqFeatureDev/session
2 files changed
+42
-6
lines changedLines changed: 16 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
| 13 | + | |
11 | 14 | | |
12 | 15 | | |
13 | 16 | | |
| |||
20 | 23 | | |
21 | 24 | | |
22 | 25 | | |
23 | | - | |
24 | | - | |
25 | | - | |
26 | | - | |
27 | | - | |
28 | | - | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
29 | 39 | | |
30 | 40 | | |
31 | 41 | | |
| |||
Lines changed: 26 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
0 commit comments