Skip to content

Commit

Permalink
watchRelease now uses logs instead of monitoring
Browse files Browse the repository at this point in the history
  • Loading branch information
rugwirobaker committed Oct 6, 2021
1 parent 2b76b4f commit 01f5a72
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"github.com/superfly/flyctl/internal/cmdutil"
"github.com/superfly/flyctl/internal/deployment"
"github.com/superfly/flyctl/internal/flyerr"
"github.com/superfly/flyctl/internal/monitor"
"github.com/superfly/flyctl/pkg/logs"
"github.com/superfly/flyctl/terminal"
"golang.org/x/sync/errgroup"
)
Expand Down Expand Up @@ -269,31 +269,30 @@ func watchReleaseCommand(ctx context.Context, cc *cmdctx.CmdContext, apiClient *
ctx, cancel := context.WithCancel(ctx)
defer cancel()

ls := monitor.NewLogStream(cc.Client.API())
opts := monitor.LogOptions{MaxBackoff: 1 * time.Second, AppName: cc.AppName, VMID: vmid}
opts := &logs.LogOptions{MaxBackoff: 1 * time.Second, AppName: cc.AppName, VMID: vmid}

for logs := range ls.Stream(ctx, opts) {
if len(logs) == 0 {
continue
}
ls, err := logs.NewNatsStream(apiClient, opts)
if err != nil {
return err
}

for entry := range ls.Stream(ctx, opts) {

func() {
if interactive {
s.Stop()
defer s.Start()
}

for _, l := range logs {
fmt.Println("\t", l.Message)
fmt.Println("\t", entry.Message)

// watch for the shutdown message
if l.Message == "Starting clean up." {
cancel()
}
// watch for the shutdown message
if entry.Message == "Starting clean up." {
cancel()
}

}()
}

return ls.Err()
})
})
Expand Down

0 comments on commit 01f5a72

Please sign in to comment.