diff --git a/Anvil/Tools/Database.pm b/Anvil/Tools/Database.pm index 1db12b3a..b57200bd 100644 --- a/Anvil/Tools/Database.pm +++ b/Anvil/Tools/Database.pm @@ -18151,6 +18151,9 @@ sub resync_databases # We're done with the table data, clear it. 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. $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} }}); @@ -19728,7 +19731,7 @@ ORDER BY push @{$queries}, "DELETE FROM variables WHERE variable_uuid = ".$anvil->Database->quote($variable_uuid).";"; 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__}); } diff --git a/tools/anvil-configure-host b/tools/anvil-configure-host index 381369c7..adc32550 100755 --- a/tools/anvil-configure-host +++ b/tools/anvil-configure-host @@ -50,7 +50,7 @@ if (($< != 0) && ($> != 0)) } # 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 => 2, 'print' => 1, key => "log_0132"}); if (not $anvil->data->{sys}{database}{connections}) diff --git a/tools/anvil-daemon b/tools/anvil-daemon index ef59e072..ddf28133 100755 --- a/tools/anvil-daemon +++ b/tools/anvil-daemon @@ -580,6 +580,16 @@ sub handle_periodic_tasks $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { host_type => $host_type }}); 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 # run. To be safe, we'll still background it. my $shell_call = $anvil->data->{path}{exe}{'striker-get-screenshots'}.$anvil->Log->switches; @@ -593,12 +603,6 @@ sub handle_periodic_tasks output => $output, 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}); - } } }