# HG changeset patch # User Sascha L. Teichmann # Date 1551371334 -3600 # Node ID 242104c338ff2c77bb58ade2778d4ffb3ca15a1f # Parent c85b16db8a02caf562e727d11dabc0ee8014935f Wrap writing of iso-lines of differences into a transaction. diff -r c85b16db8a02 -r 242104c338ff cmd/octreediff/main.go --- a/cmd/octreediff/main.go Thu Feb 28 15:55:32 2019 +0100 +++ b/cmd/octreediff/main.go Thu Feb 28 17:28:54 2019 +0100 @@ -226,6 +226,11 @@ } defer conn.Close() + tx, err := conn.BeginTx(ctx, nil) + if err != nil { + return err + } + type load struct { date time.Time data []byte @@ -261,7 +266,7 @@ {date: secondDate, dst: &second, err: &secondErr}, } { var data []byte - if err := conn.QueryRowContext( + if err := tx.QueryRowContext( ctx, loadOctreeSQL, bottleneck, @@ -358,7 +363,7 @@ var tin octree.Tin - if err := conn.QueryRowContext( + if err := tx.QueryRowContext( ctx, triangulateSQL, bottleneck, @@ -414,7 +419,7 @@ var dataSize int - stmt, err := conn.PrepareContext(ctx, insertContourSQL) + stmt, err := tx.PrepareContext(ctx, insertContourSQL) if err != nil { return err } @@ -445,7 +450,7 @@ log.Printf("generating iso lines took %v\n", now.Sub(last)) last = now - return nil + return tx.Commit() }) }