Skip to content
Snippets Groups Projects
Unverified Commit d6e2383b authored by Angelo Capossele's avatar Angelo Capossele Committed by GitHub
Browse files

:wrench: Change spammer API to accept message per minute (#635)

parent 7fa9138e
Branches
Tags
No related merge requests found
...@@ -15,12 +15,12 @@ func handleRequest(c echo.Context) error { ...@@ -15,12 +15,12 @@ func handleRequest(c echo.Context) error {
switch request.Cmd { switch request.Cmd {
case "start": case "start":
if request.MPS == 0 { if request.MPM == 0 {
request.MPS = 1 request.MPM = 1
} }
messageSpammer.Shutdown() messageSpammer.Shutdown()
messageSpammer.Start(request.MPS, time.Second) messageSpammer.Start(request.MPM, time.Minute)
return c.JSON(http.StatusOK, Response{Message: "started spamming messages"}) return c.JSON(http.StatusOK, Response{Message: "started spamming messages"})
case "stop": case "stop":
messageSpammer.Shutdown() messageSpammer.Shutdown()
...@@ -39,5 +39,5 @@ type Response struct { ...@@ -39,5 +39,5 @@ type Response struct {
// Request contains the parameters of a spammer request. // Request contains the parameters of a spammer request.
type Request struct { type Request struct {
Cmd string `json:"cmd"` Cmd string `json:"cmd"`
MPS int `json:"mps"` MPM int `json:"mpm"`
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment