Mercurial > gemma
comparison pkg/imports/isr.go @ 4215:e453d3bf7663
Refresh iso contours import: Fixed usage of SQL to list all bottlenecks.
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Fri, 16 Aug 2019 14:38:19 +0200 |
parents | 49564382ffff |
children | cbc75527916f |
comparison
equal
deleted
inserted
replaced
4214:49564382ffff | 4215:e453d3bf7663 |
---|---|
62 ) | 62 ) |
63 | 63 |
64 func (isr *IsoRefresh) CleanUp() error { return nil } | 64 func (isr *IsoRefresh) CleanUp() error { return nil } |
65 | 65 |
66 type bottleneckSoundingResults struct { | 66 type bottleneckSoundingResults struct { |
67 bn int64 | 67 bn string |
68 srs []int64 | 68 srs []int64 |
69 } | 69 } |
70 | 70 |
71 func fetchBottleneckResults( | 71 func fetchBottleneckResults( |
72 ctx context.Context, | 72 ctx context.Context, |
80 defer rows.Close() | 80 defer rows.Close() |
81 | 81 |
82 var ids []bottleneckSoundingResults | 82 var ids []bottleneckSoundingResults |
83 | 83 |
84 for rows.Next() { | 84 for rows.Next() { |
85 var bn, sr int64 | 85 var bn string |
86 if err := rows.Scan(&bn, sr); err != nil { | 86 var sr int64 |
87 if err := rows.Scan(&bn, &sr); err != nil { | |
87 return nil, err | 88 return nil, err |
88 } | 89 } |
89 if len(ids) > 0 { | 90 if len(ids) > 0 { |
90 if ids[len(ids)-1].bn != bn { | 91 if ids[len(ids)-1].bn != bn { |
91 ids = append(ids, bottleneckSoundingResults{ | 92 ids = append(ids, bottleneckSoundingResults{ |
137 err := isr.processBottleneck( | 138 err := isr.processBottleneck( |
138 ctx, conn, | 139 ctx, conn, |
139 heights, | 140 heights, |
140 &bns[i], | 141 &bns[i], |
141 ) | 142 ) |
142 feedback.Info("Processing bottleneck with ID %d took %v", | 143 feedback.Info("Processing bottleneck '%s' took %v", |
143 bns[i].bn, | 144 bns[i].bn, |
144 time.Since(start)) | 145 time.Since(start)) |
145 if err != nil { | 146 if err != nil { |
146 return nil, err | 147 return nil, err |
147 } | 148 } |