Mercurial > gemma
changeset 2253:cfc523c70e90
Uploaded imports: Small code clean-ups.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Wed, 13 Feb 2019 17:09:11 +0100 |
parents | f8f2c4d88939 |
children | b53206045699 |
files | pkg/imports/bn.go pkg/imports/fa.go pkg/imports/ubn.go |
diffstat | 3 files changed, 10 insertions(+), 13 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/imports/bn.go Wed Feb 13 16:59:38 2019 +0100 +++ b/pkg/imports/bn.go Wed Feb 13 17:09:11 2019 +0100 @@ -144,7 +144,7 @@ feedback Feedback, ) (interface{}, error) { - fetch := func(feedback Feedback) ([]*ifbn.BottleNeckType, error) { + fetch := func() ([]*ifbn.BottleNeckType, error) { client := ifbn.NewIBottleneckService(bn.URL, bn.Insecure, nil) req := &ifbn.Export_bn_by_isrs{} @@ -166,14 +166,14 @@ func storeBottlenecks( ctx context.Context, - fetch func(Feedback) ([]*ifbn.BottleNeckType, error), + fetch func() ([]*ifbn.BottleNeckType, error), importID int64, conn *sql.Conn, feedback Feedback, ) (interface{}, error) { start := time.Now() - bns, err := fetch(feedback) + bns, err := fetch() if err != nil { return nil, err }
--- a/pkg/imports/fa.go Wed Feb 13 16:59:38 2019 +0100 +++ b/pkg/imports/fa.go Wed Feb 13 17:09:11 2019 +0100 @@ -485,9 +485,10 @@ client := ifaf.NewFairwayAvailabilityService(fa.URL, fa.Insecure, nil) - var period ifaf.RequestedPeriod - period.Date_start = latest.Time - period.Date_end = time.Now() + period := ifaf.RequestedPeriod{ + Date_start: latest.Time, + Date_end: time.Now(), + } ids := ifaf.ArrayOfString{String: bns}
--- a/pkg/imports/ubn.go Wed Feb 13 16:59:38 2019 +0100 +++ b/pkg/imports/ubn.go Wed Feb 13 17:09:11 2019 +0100 @@ -33,9 +33,7 @@ type ubnJobCreator struct{} -func init() { - RegisterJobCreator(UBNJobKind, ubnJobCreator{}) -} +func init() { RegisterJobCreator(UBNJobKind, ubnJobCreator{}) } func (ubnJobCreator) Description() string { return "uploaded bottlenecks" } @@ -59,9 +57,7 @@ } // CleanUp of a uploaded bottleneck import removes the temp dir. -func (ubn *UploadedBottleneck) CleanUp() error { - return os.RemoveAll(ubn.Dir) -} +func (ubn *UploadedBottleneck) CleanUp() error { return os.RemoveAll(ubn.Dir) } // Do executes the actual uploaded bottleneck import. func (ubn *UploadedBottleneck) Do( @@ -71,7 +67,7 @@ feedback Feedback, ) (interface{}, error) { - fetch := func(feedback Feedback) ([]*ifbn.BottleNeckType, error) { + fetch := func() ([]*ifbn.BottleNeckType, error) { var dst ifbn.Export_bn_by_isrsResponse if err := soap.ValidateFile( filepath.Join(ubn.Dir, "data.xml"),