Browse Source

bug(plugin): random plugin config now distincts int and float, so should check for the correct type.

ngjaying 5 years atrás
parent
commit
5e0f59d2e1
1 changed files with 4 additions and 4 deletions
  1. 4 4
      plugins/sources/random.go

+ 4 - 4
plugins/sources/random.go

@@ -16,8 +16,8 @@ type randomSource struct {
 }
 
 func (s *randomSource) Configure(topic string, props map[string]interface{}) error {
-	if i, ok := props["interval"].(float64); ok {
-		s.interval = int(i)
+	if i, ok := props["interval"].(int); ok {
+		s.interval = i
 	} else {
 		s.interval = 1000
 	}
@@ -27,8 +27,8 @@ func (s *randomSource) Configure(topic string, props map[string]interface{}) err
 		s.pattern = make(map[string]interface{})
 		s.pattern["count"] = 50
 	}
-	if i, ok := props["seed"].(float64); ok {
-		s.seed = int(i)
+	if i, ok := props["seed"].(int); ok {
+		s.seed = i
 	} else {
 		s.seed = 1
 	}