From: Steinar H. Gunderson Date: Wed, 16 Nov 2016 17:39:11 +0000 (+0100) Subject: Reduce the number of Postgres transactions we start. X-Git-Url: https://git.sesse.net/?p=remoteglot;a=commitdiff_plain;h=ce5f6b655d5daa42abb79961aa18cf7b90db1f74;hp=f72838ebf2ced1db4d3b3c1b06787180df6ae10f;ds=sidebyside Reduce the number of Postgres transactions we start. --- diff --git a/remoteglot.pl b/remoteglot.pl index 9cbf820..35fe887 100755 --- a/remoteglot.pl +++ b/remoteglot.pl @@ -901,6 +901,7 @@ sub output_json { 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; @@ -917,6 +918,7 @@ sub output_json { ($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