Mercurial > gemma
changeset 3186:928cdc06ff37
Warn only once if gauge is unknown
Makes the import faster by some orders of magnitude in the worst
case scenario of a large CSV file with only unknown gauges.
author | Tom Gottfried <tom@intevation.de> |
---|---|
date | Tue, 07 May 2019 18:35:11 +0200 |
parents | 505414dfe3e7 |
children | 5487abeb380c |
files | pkg/imports/agm.go |
diffstat | 1 files changed, 4 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/pkg/imports/agm.go Tue May 07 17:38:25 2019 +0200 +++ b/pkg/imports/agm.go Tue May 07 18:35:11 2019 +0200 @@ -302,16 +302,19 @@ return nil, err } defer gaugeCheckStmt.Close() + selectStmt, err := tx.PrepareContext(ctx, agmSelectSQL) if err != nil { return nil, err } defer selectStmt.Close() + insertStmt, err := tx.PrepareContext(ctx, agmInsertSQL) if err != nil { return nil, err } defer insertStmt.Close() + trackStmt, err := tx.PrepareContext(ctx, trackImportSQL) if err != nil { return nil, err @@ -341,7 +344,7 @@ if exists, found := checkedGauges[*gid]; found { if !exists { - feedback.Warn("Ignoring data for unknown gauge %s", gid.String()) + // Just ignore the line since we have already warned continue lines } } else { // not found in gauge cache