Skip to content

Commit

Permalink
print watches warning after the clean command finishes (#936)
Browse files Browse the repository at this point in the history
* print watches warning after the clean command finishes to avoid overrides

Signed-off-by: Ramiro Berrelleza <rberrelleza@gmail.com>
  • Loading branch information
rberrelleza committed Jun 18, 2020
1 parent 644dad2 commit f1dc839
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
24 changes: 13 additions & 11 deletions cmd/up.go
Expand Up @@ -80,7 +80,7 @@ type UpContext struct {
Exit chan error
Sy *syncthing.Syncthing
ErrChan chan error
cleaned chan struct{}
cleaned chan string
success bool
}

Expand Down Expand Up @@ -263,7 +263,7 @@ func (up *UpContext) Activate(autoDeploy, build, resetSyncthing bool) {
up.Disconnect = make(chan error, 1)
up.Running = make(chan error, 1)
up.ErrChan = make(chan error, 1)
up.cleaned = make(chan struct{}, 1)
up.cleaned = make(chan string, 1)

d, create, err := up.getCurrentDeployment(autoDeploy)
if err != nil {
Expand Down Expand Up @@ -333,10 +333,17 @@ func (up *UpContext) Activate(autoDeploy, build, resetSyncthing bool) {
up.retry = true

log.Success("Files synchronized")
printDisplayContext(up.Dev)

go func() {
<-up.cleaned
output := <-up.cleaned

if utils.IsWatchesConfigurationTooLow(output) {
log.Yellow("\nThe value of /proc/sys/fs/inotify/max_user_watches in your cluster nodes is too low.")
log.Yellow("This can affect okteto's file synchronization performance.")
log.Yellow("Visit https://okteto.com/docs/reference/known-issues/index.html for more information.")
}

printDisplayContext(up.Dev)
up.Running <- up.runCommand()
}()

Expand Down Expand Up @@ -806,16 +813,11 @@ func (up *UpContext) cleanCommand() {

if err != nil {
log.Infof("failed to clean session: %s", err)
up.cleaned <- struct{}{}
up.cleaned <- ""
return
}

if utils.IsWatchesConfigurationTooLow(out.String()) {
log.Yellow("\nThe value of /proc/sys/fs/inotify/max_user_watches in your cluster nodes is too low.")
log.Yellow("This can affect Okteto's file synchronization performance.")
log.Yellow("Visit https://okteto.com/docs/reference/known-issues/index.html for more information.")
}
up.cleaned <- struct{}{}
up.cleaned <- out.String()
}

func (up *UpContext) runCommand() error {
Expand Down
2 changes: 1 addition & 1 deletion pkg/k8s/pods/pod.go
Expand Up @@ -288,7 +288,7 @@ func parseUserID(output string) int64 {
}

if !strings.HasPrefix(lines[0], "USER:") {
log.Infof("USER entry not not found in first development container log line: %s", lines[0])
log.Infof("USER is not the first log line: %s", lines[0])
return -1
}

Expand Down

0 comments on commit f1dc839

Please sign in to comment.