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')
->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 $@;