Commit 195eed4
fix: race condition in Lua script SHA-1 loading (#108)
Replace singleflight with simpler mutex double-check pattern for loading
SHA-1 from Valkey. When multiple goroutines call Exec() concurrently:
1. First goroutine acquires the write lock and loads SHA-1
2. Other goroutines wait on the lock, then see SHA-1 already set
This is simpler and avoids the race where a second goroutine could
re-execute the singleflight after it completes.
Signed-off-by: Rueian <rueiancsie@gmail.com>1 parent b093580 commit 195eed4
2 files changed
+37
-12
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
86 | 86 | | |
87 | 87 | | |
88 | 88 | | |
89 | | - | |
90 | 89 | | |
91 | 90 | | |
92 | 91 | | |
| |||
111 | 110 | | |
112 | 111 | | |
113 | 112 | | |
114 | | - | |
115 | 113 | | |
116 | | - | |
| 114 | + | |
| 115 | + | |
117 | 116 | | |
118 | 117 | | |
119 | | - | |
120 | 118 | | |
| 119 | + | |
121 | 120 | | |
122 | | - | |
| 121 | + | |
123 | 122 | | |
124 | | - | |
125 | | - | |
126 | | - | |
127 | | - | |
128 | 123 | | |
129 | | - | |
130 | | - | |
131 | 124 | | |
132 | | - | |
| 125 | + | |
133 | 126 | | |
134 | 127 | | |
135 | 128 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| 7 | + | |
7 | 8 | | |
8 | 9 | | |
9 | 10 | | |
| |||
527 | 528 | | |
528 | 529 | | |
529 | 530 | | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
530 | 562 | | |
531 | 563 | | |
532 | 564 | | |
| |||
0 commit comments