Adding transaction to the bot.

This commit is contained in:
sergiotarxz 2024-05-06 22:17:33 +02:00
parent 4ba198be51
commit 42dc2fb56e

View File

@ -124,6 +124,7 @@ sub fetch_gts_data {
$html->find('.gtsPokemonSummary.gtsOffer.pfBoxThin.pfFormGroup') $html->find('.gtsPokemonSummary.gtsOffer.pfBoxThin.pfFormGroup')
->each; ->each;
my $db = GTSRSSApi::DB->connect; my $db = GTSRSSApi::DB->connect;
local $db->{AutoCommit} = 0;
$db->do( <<'EOF', undef ); $db->do( <<'EOF', undef );
UPDATE offers SET marked_to_check_is_available = true WHERE is_available = true; UPDATE offers SET marked_to_check_is_available = true WHERE is_available = true;
EOF EOF
@ -423,6 +424,7 @@ EOF
$db->do( <<'EOF', undef ); $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; UPDATE offers SET is_available = false, marked_to_check_is_available = false = true WHERE is_available and marked_to_check_is_available;
EOF EOF
$db->commit;
}; };
if ($@) { if ($@) {
warn $@; warn $@;