my $tb_retry_timer = undef;
my %tb_cache = ();
my $tb_lookup_running = 0;
+my $last_written_json = undef;
# TODO: Persist (parts of) this so that we can restart.
my %clock_target_for_pos = ();
warn "Error in parsing PGN from $url\n";
} else {
eval {
+ # Skip to the right game.
+ while (defined($remoteglotconf::pgn_filter) &&
+ !&$remoteglotconf::pgn_filter($pgn)) {
+ $pgn->read_game() or die "Out of games during filtering";
+ }
+
$pgn->parse_game({ save_comments => 'yes' });
my $pos = Position->start_pos($pgn->white, $pgn->black);
my $moves = $pgn->moves;
}
};
if ($@) {
- warn "Error in parsing moves from $url\n";
+ warn "Error in parsing moves from $url: $@\n";
}
}
$json->{'refutation_lines'} = \%refutation_lines;
my $encoded = JSON::XS::encode_json($json);
- unless ($historic_json_only || !defined($remoteglotconf::json_output)) {
+ unless ($historic_json_only || !defined($remoteglotconf::json_output) ||
+ (defined($last_written_json) && $last_written_json eq $encoded)) {
atomic_set_contents($remoteglotconf::json_output, $encoded);
+ $last_written_json = $encoded;
}
if (exists($pos_calculating->{'pretty_history'}) &&