Skip to content

Commit

Permalink
Merge pull request #887 from devspace-cloud/small-fix
Browse files Browse the repository at this point in the history
Small fix
  • Loading branch information
FabianKramm committed Jan 20, 2020
2 parents 66a865b + fcf2409 commit a3da218
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
2 changes: 1 addition & 1 deletion pkg/devspace/services/port_forwarding.go
Expand Up @@ -116,7 +116,7 @@ func (serviceClient *client) startForwarding(portForwarding *latest.PortForwardi
err = serviceClient.startForwarding(portForwarding, interrupt, logpkg.Discard)
if err != nil {
serviceClient.log.Errorf("Error restarting port-forwarding: %v", err)
serviceClient.log.Errorf("Will try again in 3 seconds", err)
serviceClient.log.Errorf("Will try again in 3 seconds")
continue
}

Expand Down
12 changes: 9 additions & 3 deletions pkg/devspace/services/sync.go
Expand Up @@ -146,8 +146,10 @@ func (serviceClient *client) startSyncClient(options *startClientOptions, log lo
return errors.Errorf("Error selecting pod: %v", err)
}

syncDone := make(chan bool)

log.StartWait("Starting sync...")
syncClient, err := serviceClient.startSync(pod, container.Name, syncConfig, options.Verbose, options.SyncDone, options.SyncLog)
syncClient, err := serviceClient.startSync(pod, container.Name, syncConfig, options.Verbose, syncDone, options.SyncLog)
log.StopWait()
if err != nil {
return errors.Wrap(err, "start sync")
Expand Down Expand Up @@ -181,20 +183,24 @@ func (serviceClient *client) startSyncClient(options *startClientOptions, log lo
serviceClient.log.Fatalf("Fatal error in sync: %v", err)
}

options.RestartLog.Info("Restarting sync...")
for {
time.Sleep(time.Second * 5)
err := serviceClient.startSyncClient(options, options.RestartLog)
if err != nil {
serviceClient.log.Errorf("Error restarting sync: %v", err)
serviceClient.log.Errorf("Will try again in 5 seconds", err)
serviceClient.log.Errorf("Will try again in 5 seconds")
continue
}

break
}
case <-options.Interrupt:
syncClient.Stop(nil)
case <-syncClient.Options.SyncDone:
case <-syncDone:
if options.SyncDone != nil {
close(options.SyncDone)
}
}
}(syncClient, options)
}
Expand Down
11 changes: 4 additions & 7 deletions pkg/devspace/sync/sync.go
Expand Up @@ -254,11 +254,9 @@ func (s *Sync) startDownstream() {
}

func (s *Sync) initialSync() error {
if s.Options.DownstreamDisabled == false {
err := s.downstream.populateFileMap()
if err != nil {
return errors.Wrap(err, "populate file map")
}
err := s.downstream.populateFileMap()
if err != nil {
return errors.Wrap(err, "populate file map")
}

localChanges := make([]*FileInformation, 0, 10)
Expand All @@ -274,7 +272,7 @@ func (s *Sync) initialSync() error {
}
s.fileIndex.fileMapMutex.Unlock()

err := s.diffServerClient(s.LocalPath, &localChanges, fileMapClone, false)
err = s.diffServerClient(s.LocalPath, &localChanges, fileMapClone, false)
if err != nil {
return errors.Wrap(err, "diff server client")
}
Expand Down Expand Up @@ -525,7 +523,6 @@ func (s *Sync) Stop(fatalError error) {

if s.Options.SyncError != nil {
s.Options.SyncError <- fatalError
close(s.Options.SyncError)
}
}

Expand Down

0 comments on commit a3da218

Please sign in to comment.