]> git.sesse.net Git - remoteglot/commitdiff
Reduce the number of Postgres transactions we start.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 16 Nov 2016 17:39:11 +0000 (18:39 +0100)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 16 Nov 2016 17:39:28 +0000 (18:39 +0100)
remoteglot.pl

index 9cbf820d5dcd336d5e0bff16d118da711462e84f..35fe887382eaabb2cc0e0dd7be9a8809c9bf4eea 100755 (executable)
@@ -901,6 +901,7 @@ sub output_json {
        if (!$historic_json_only && exists($pos_calculating->{'history'})) {
                my %score_history = ();
 
        if (!$historic_json_only && exists($pos_calculating->{'history'})) {
                my %score_history = ();
 
+               local $dbh->{AutoCommit} = 0;
                my $q = $dbh->prepare('SELECT * FROM scores WHERE id=?');
                my $pos = Position->start_pos('white', 'black');
                my $halfmove_num = 0;
                my $q = $dbh->prepare('SELECT * FROM scores WHERE id=?');
                my $pos = Position->start_pos('white', 'black');
                my $halfmove_num = 0;
@@ -917,6 +918,7 @@ sub output_json {
                        ($pos) = $pos->make_pretty_move($move);
                }
                $q->finish;
                        ($pos) = $pos->make_pretty_move($move);
                }
                $q->finish;
+               $dbh->commit;
 
                # If at any point we are missing 10 consecutive moves,
                # truncate the history there. This is so we don't get into
 
                # If at any point we are missing 10 consecutive moves,
                # truncate the history there. This is so we don't get into