From 42dc2fb56ee9053225b68ec2b4626074dd69223d Mon Sep 17 00:00:00 2001 From: sergiotarxz Date: Mon, 6 May 2024 22:17:33 +0200 Subject: [PATCH] Adding transaction to the bot. --- lib/GTSRSSApi.pm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/GTSRSSApi.pm b/lib/GTSRSSApi.pm index b9ba7f8..c044c10 100644 --- a/lib/GTSRSSApi.pm +++ b/lib/GTSRSSApi.pm @@ -124,6 +124,7 @@ sub fetch_gts_data { $html->find('.gtsPokemonSummary.gtsOffer.pfBoxThin.pfFormGroup') ->each; my $db = GTSRSSApi::DB->connect; + local $db->{AutoCommit} = 0; $db->do( <<'EOF', undef ); UPDATE offers SET marked_to_check_is_available = true WHERE is_available = true; EOF @@ -423,6 +424,7 @@ EOF $db->do( <<'EOF', undef ); UPDATE offers SET is_available = false, marked_to_check_is_available = false = true WHERE is_available and marked_to_check_is_available; EOF + $db->commit; }; if ($@) { warn $@;