mirror of https://github.com/databricks/cli.git
Address feedback
This commit is contained in:
parent
75b2bcbea9
commit
5c850df92c
|
@ -12,7 +12,7 @@ import (
|
|||
)
|
||||
|
||||
type upload struct {
|
||||
outpuHandler sync.OutputHandler
|
||||
outputHandler sync.OutputHandler
|
||||
}
|
||||
|
||||
func (m *upload) Name() string {
|
||||
|
@ -26,19 +26,18 @@ func (m *upload) Apply(ctx context.Context, b *bundle.Bundle) diag.Diagnostics {
|
|||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
opts.OutputHandler = m.outpuHandler
|
||||
opts.OutputHandler = m.outputHandler
|
||||
sync, err := sync.New(ctx, *opts)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
defer sync.Close()
|
||||
|
||||
b.Files, err = sync.RunOnce(ctx)
|
||||
if err != nil {
|
||||
return diag.FromErr(err)
|
||||
}
|
||||
|
||||
sync.Close()
|
||||
|
||||
log.Infof(ctx, "Uploaded bundle files")
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -134,6 +134,7 @@ func New() *cobra.Command {
|
|||
if err != nil {
|
||||
return err
|
||||
}
|
||||
defer s.Close()
|
||||
|
||||
if f.watch {
|
||||
err = s.RunContinuous(ctx)
|
||||
|
@ -141,7 +142,6 @@ func New() *cobra.Command {
|
|||
_, err = s.RunOnce(ctx)
|
||||
}
|
||||
|
||||
s.Close()
|
||||
return err
|
||||
}
|
||||
|
||||
|
|
|
@ -53,8 +53,11 @@ type Sync struct {
|
|||
|
||||
// Synchronization progress events are sent to this event notifier.
|
||||
notifier EventNotifier
|
||||
outputWaitGroup *stdsync.WaitGroup
|
||||
seq int
|
||||
|
||||
// WaitGroup is automatically created when an output handler is provided in the SyncOptions.
|
||||
// Close call is required to ensure the output handler goroutine handles all events in time.
|
||||
outputWaitGroup *stdsync.WaitGroup
|
||||
}
|
||||
|
||||
// New initializes and returns a new [Sync] instance.
|
||||
|
@ -140,12 +143,6 @@ func New(ctx context.Context, opts SyncOptions) (*Sync, error) {
|
|||
}, nil
|
||||
}
|
||||
|
||||
func (s *Sync) Events() <-chan Event {
|
||||
ch := make(chan Event, MaxRequestsInFlight)
|
||||
s.notifier = &ChannelNotifier{ch}
|
||||
return ch
|
||||
}
|
||||
|
||||
func (s *Sync) Close() {
|
||||
if s.notifier == nil {
|
||||
return
|
||||
|
|
Loading…
Reference in New Issue