Skip to content

Commit 6cb3132

Browse files
committed
Merge branch '309-reload-connection-options' into 'master'
fix: reload dump/restore connection options (#309) See merge request postgres-ai/database-lab!401
2 parents 2ee4169 + 2b389cc commit 6cb3132

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

Diff for: internal/retrieval/retrieval.go

+16-10
Original file line numberDiff line numberDiff line change
@@ -80,16 +80,7 @@ func New(cfg *dblabCfg.Config, engineProps global.EngineProps, docker *client.Cl
8080
},
8181
}
8282

83-
for _, jobName := range r.cfg.Jobs {
84-
jobSpec, ok := r.cfg.JobsSpec[jobName]
85-
if !ok {
86-
continue
87-
}
88-
89-
jobSpec.Name = jobName
90-
r.jobSpecs[jobName] = jobSpec
91-
}
92-
83+
r.formatJobsSpec()
9384
r.defineRetrievalMode()
9485

9586
return r
@@ -99,6 +90,8 @@ func New(cfg *dblabCfg.Config, engineProps global.EngineProps, docker *client.Cl
9990
func (r *Retrieval) Reload(ctx context.Context, cfg *dblabCfg.Config) {
10091
*r.cfg = cfg.Retrieval
10192

93+
r.formatJobsSpec()
94+
10295
for _, job := range r.jobs {
10396
cfg, ok := r.cfg.JobsSpec[job.Name()]
10497
if !ok {
@@ -111,9 +104,22 @@ func (r *Retrieval) Reload(ctx context.Context, cfg *dblabCfg.Config) {
111104
}
112105
}
113106

107+
r.stopScheduler()
114108
r.setupScheduler(ctx)
115109
}
116110

111+
func (r *Retrieval) formatJobsSpec() {
112+
for _, jobName := range r.cfg.Jobs {
113+
jobSpec, ok := r.cfg.JobsSpec[jobName]
114+
if !ok {
115+
continue
116+
}
117+
118+
jobSpec.Name = jobName
119+
r.jobSpecs[jobName] = jobSpec
120+
}
121+
}
122+
117123
// Run start retrieving process.
118124
func (r *Retrieval) Run(ctx context.Context) error {
119125
runCtx, cancel := context.WithCancel(ctx)

0 commit comments

Comments
 (0)