package main import ( "fmt" "os" "time" "github.com/gin-gonic/gin" "vk-webhook-flooder-mock/handler" ) func main() { if len(os.Args) > 1 && os.Args[1] == "teststore" { f := newFetcher("token") go func() { for i := 0; i < 1000; i++ { f.Enqueue(int64(i)) time.Sleep(time.Millisecond) } }() fmt.Printf("starting") for { fmt.Printf("\033[2K\roffload: %d, output: %d, result: %d", f.offload.Len(), len(f.output), f.result.Len()) time.Sleep(time.Millisecond) } } gin.SetMode(gin.ReleaseMode) g := gin.New() g.Use(gin.Recovery()) g.GET("/flood", handler.FloodHandler) g.GET("/concurrentflood", handler.ConcurrentFloodHandler) g.POST("/method/users.get", vkRateLimit(), handler.UsersGetHandler) g.POST("/api/transport/v1/messages", mgRateLimit(), handler.NewMessageHandler) g.Run(":8090") }