Performance and API improvements for the replay function

This commit is contained in:
2026-06-26 11:31:46 +01:00
parent 7939f07f34
commit c23c39d889
5 changed files with 123 additions and 49 deletions
+7 -1
View File
@@ -15,8 +15,14 @@ func replayAction(cmd *cobra.Command, args []string) {
port, _ := cmd.Flags().GetInt("port")
loop, _ := cmd.Flags().GetBool("loop")
replayer, err := mockserver.NewReplayer(address, port, inputFile)
if err != nil {
fmt.Printf("Something went wrong setting up the player: %+v", err)
return
}
ctx := context.Background()
if err := mockserver.Replay(ctx, address, port, loop, inputFile); err != nil {
if err := replayer.Replay(ctx, loop); err != nil {
fmt.Printf("Something went wrong while playing the file: %v", err)
}
}