Skip to content

Commit c0d7918

Browse files
committed
review feedback
Signed-off-by: Huamin Chen <[email protected]>
1 parent eaafb57 commit c0d7918

File tree

3 files changed

+10
-8
lines changed

3 files changed

+10
-8
lines changed

src/semantic-router/pkg/cache/hybrid_cache.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -580,9 +580,6 @@ func (h *HybridCache) FindSimilar(model string, query string) ([]byte, bool, err
580580
metrics.RecordCacheOperation("hybrid", "find_similar", "miss", time.Since(start).Seconds())
581581
metrics.RecordCacheMiss()
582582

583-
// Suppress context error to avoid noise
584-
_ = ctx
585-
586583
return nil, false, nil
587584
}
588585

src/semantic-router/pkg/cache/milvus_cache.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -205,10 +205,14 @@ func loadMilvusConfig(configPath string) (*MilvusConfig, error) {
205205
fmt.Printf("[DEBUG] Development.AutoCreateCollection: %v\n", config.Development.AutoCreateCollection)
206206
fmt.Printf("[DEBUG] Development.DropCollectionOnStartup: %v\n", config.Development.DropCollectionOnStartup)
207207

208-
// WORKAROUND: Force development settings for benchmarks
208+
// WORKAROUND: Force development settings for benchmarks/tests only
209209
// There seems to be a YAML parsing issue with sigs.k8s.io/yaml
210-
if !config.Development.AutoCreateCollection && !config.Development.DropCollectionOnStartup {
211-
fmt.Printf("[WARN] Development settings parsed as false, forcing to true for benchmarks\n")
210+
// Only apply this workaround if SR_BENCHMARK_MODE or SR_TEST_MODE is set
211+
benchmarkMode := os.Getenv("SR_BENCHMARK_MODE")
212+
testMode := os.Getenv("SR_TEST_MODE")
213+
if (benchmarkMode == "1" || benchmarkMode == "true" || testMode == "1" || testMode == "true") &&
214+
!config.Development.AutoCreateCollection && !config.Development.DropCollectionOnStartup {
215+
fmt.Printf("[WARN] Development settings parsed as false, forcing to true for benchmarks/tests\n")
212216
config.Development.AutoCreateCollection = true
213217
config.Development.DropCollectionOnStartup = true
214218
}

src/semantic-router/pkg/cache/simd_benchmark_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package cache
22

33
import (
4+
"fmt"
45
"math/rand"
56
"testing"
67
)
@@ -19,7 +20,7 @@ func BenchmarkDotProduct(b *testing.B) {
1920
vec_b[i] = rand.Float32()
2021
}
2122

22-
b.Run("SIMD/"+string(rune(size)), func(b *testing.B) {
23+
b.Run(fmt.Sprintf("SIMD/%d", size), func(b *testing.B) {
2324
b.ReportAllocs()
2425
var sum float32
2526
for i := 0; i < b.N; i++ {
@@ -28,7 +29,7 @@ func BenchmarkDotProduct(b *testing.B) {
2829
_ = sum
2930
})
3031

31-
b.Run("Scalar/"+string(rune(size)), func(b *testing.B) {
32+
b.Run(fmt.Sprintf("Scalar/%d", size), func(b *testing.B) {
3233
b.ReportAllocs()
3334
var sum float32
3435
for i := 0; i < b.N; i++ {

0 commit comments

Comments
 (0)