# HG changeset patch # User Tom Gottfried # Date 1557246911 -7200 # Node ID 928cdc06ff37b5be1994f00cf6ba4ac8c72e73da # Parent 505414dfe3e7adfdfde566e7807fd83794409832 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. diff -r 505414dfe3e7 -r 928cdc06ff37 pkg/imports/agm.go --- 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