Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions plugins/source/plugin.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,12 +221,12 @@ func (p *Plugin) Init(ctx context.Context, spec specs.Source) error {
return fmt.Errorf("unknown backend: %s", spec.Backend)
}

p.client, err = p.newExecutionClient(ctx, p.logger, spec, Options{Backend: p.backend})
if err != nil {
return fmt.Errorf("failed to create execution client for source plugin %s: %w", p.name, err)
}
tables := p.tables
if p.getDynamicTables != nil {
p.client, err = p.newExecutionClient(ctx, p.logger, spec, Options{Backend: p.backend})
if err != nil {
return fmt.Errorf("failed to create execution client for source plugin %s: %w", p.name, err)
}
tables, err = p.getDynamicTables(ctx, p.client)
if err != nil {
return fmt.Errorf("failed to get dynamic tables: %w", err)
Expand Down Expand Up @@ -272,6 +272,14 @@ func (p *Plugin) Sync(ctx context.Context, res chan<- *schema.Resource) error {
}
defer p.mu.Unlock()

if p.client == nil {
var err error
p.client, err = p.newExecutionClient(ctx, p.logger, p.spec, Options{Backend: p.backend})
if err != nil {
return fmt.Errorf("failed to create execution client for source plugin %s: %w", p.name, err)
}
}

startTime := time.Now()
switch p.spec.Scheduler {
case specs.SchedulerDFS:
Expand Down