Continuing to try to resolve duplicate variables bug.

* Added a called to Database->_check_for_duplicates to Database->resync_databases
* Added 'check_for_resync => 1' to anvil-configure-host.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 1 year ago
parent 2a3f0bab24
commit 9ee8f782ee
  1. 5
      Anvil/Tools/Database.pm
  2. 2
      tools/anvil-configure-host
  3. 16
      tools/anvil-daemon

@ -18151,6 +18151,9 @@ sub resync_databases
# We're done with the table data, clear it. # We're done with the table data, clear it.
delete $anvil->data->{sys}{database}{table}; delete $anvil->data->{sys}{database}{table};
# Search for duplicates from the resync
$anvil->Database->_check_for_duplicates({debug => 2});
# Clear the variable that indicates we need a resync. # Clear the variable that indicates we need a resync.
$anvil->data->{sys}{database}{resync_needed} = 0; $anvil->data->{sys}{database}{resync_needed} = 0;
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { 'sys::database::resync_needed' => $anvil->data->{sys}{database}{resync_needed} }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { 'sys::database::resync_needed' => $anvil->data->{sys}{database}{resync_needed} }});
@ -19728,7 +19731,7 @@ ORDER BY
push @{$queries}, "DELETE FROM variables WHERE variable_uuid = ".$anvil->Database->quote($variable_uuid).";"; push @{$queries}, "DELETE FROM variables WHERE variable_uuid = ".$anvil->Database->quote($variable_uuid).";";
foreach my $query (@{$queries}) foreach my $query (@{$queries})
{ {
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { query => $query }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 1, list => { query => $query }});
} }
$anvil->Database->write({query => $queries, source => $THIS_FILE, line => __LINE__}); $anvil->Database->write({query => $queries, source => $THIS_FILE, line => __LINE__});
} }

@ -50,7 +50,7 @@ if (($< != 0) && ($> != 0))
} }
# Connect # Connect
$anvil->Database->connect(); $anvil->Database->connect({debug => 2, check_for_resync => 1});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, 'print' => 1, key => "message_0031"}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 1, 'print' => 1, key => "message_0031"});
$anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, 'print' => 1, key => "log_0132"}); $anvil->Log->entry({source => $THIS_FILE, line => __LINE__, level => 2, 'print' => 1, key => "log_0132"});
if (not $anvil->data->{sys}{database}{connections}) if (not $anvil->data->{sys}{database}{connections})

@ -580,6 +580,16 @@ sub handle_periodic_tasks
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { host_type => $host_type }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { host_type => $host_type }});
if ($host_type eq "striker") if ($host_type eq "striker")
{ {
# Look for duplicates if we're the primary DB.
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => {
"sys::database::primary_db" => $anvil->data->{sys}{database}{primary_db},
"Get->host_uuid" => $anvil->Get->host_uuid,
}});
if ($anvil->Get->host_uuid eq $anvil->data->{sys}{database}{primary_db})
{
$anvil->Database->_check_for_duplicates({debug => 2});
}
# This can take a while, but it's been optimized to minimize how long it takes to # This can take a while, but it's been optimized to minimize how long it takes to
# run. To be safe, we'll still background it. # run. To be safe, we'll still background it.
my $shell_call = $anvil->data->{path}{exe}{'striker-get-screenshots'}.$anvil->Log->switches; my $shell_call = $anvil->data->{path}{exe}{'striker-get-screenshots'}.$anvil->Log->switches;
@ -593,12 +603,6 @@ sub handle_periodic_tasks
output => $output, output => $output,
return_code => $return_code, return_code => $return_code,
}}); }});
# Look for duplicates if we're the primary DB.
if ($anvil->Get->host_uuid eq $anvil->data->{sys}{database}{primary_db})
{
$anvil->Database->_check_for_duplicates({debug => 2});
}
} }
} }

Loading…
Cancel
Save