File tree Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Expand file tree Collapse file tree 2 files changed +33
-2
lines changed Original file line number Diff line number Diff line change @@ -341,6 +341,32 @@ func BenchmarkClusterPing(b *testing.B) {
341341 })
342342}
343343
344+ func BenchmarkClusterDoInt (b * testing.B ) {
345+ if testing .Short () {
346+ b .Skip ("skipping in short mode" )
347+ }
348+
349+ ctx := context .Background ()
350+ cluster := newClusterScenario ()
351+ if err := startCluster (ctx , cluster ); err != nil {
352+ b .Fatal (err )
353+ }
354+ defer cluster .Close ()
355+
356+ client := cluster .newClusterClient (ctx , redisClusterOptions ())
357+ defer client .Close ()
358+
359+ b .ResetTimer ()
360+ b .RunParallel (func (pb * testing.PB ) {
361+ for pb .Next () {
362+ err := client .Do (ctx , "SET" , 10 , 10 ).Err ()
363+ if err != nil {
364+ b .Fatal (err )
365+ }
366+ }
367+ })
368+ }
369+
344370func BenchmarkClusterSetString (b * testing.B ) {
345371 if testing .Short () {
346372 b .Skip ("skipping in short mode" )
Original file line number Diff line number Diff line change @@ -151,8 +151,13 @@ func (cmd *baseCmd) stringArg(pos int) string {
151151 if pos < 0 || pos >= len (cmd .args ) {
152152 return ""
153153 }
154- s , _ := cmd .args [pos ].(string )
155- return s
154+ arg := cmd .args [pos ]
155+ switch v := arg .(type ) {
156+ case string :
157+ return v
158+ default :
159+ return fmt .Sprintf ("%v" , v )
160+ }
156161}
157162
158163func (cmd * baseCmd ) firstKeyPos () int8 {
You can’t perform that action at this time.
0 commit comments