Fixed a bug in Storage->push_file() where file path wasn't updated from incoming to files, preventing the push to other hosts from working. Also fixed a minor issue where the file size was sometimes 0, making transfer calculations useless.

Signed-off-by: digimer <mkelly@alteeve.ca>
main
digimer 2 years ago
parent d59034a488
commit ab3e8afe6e
  1. 6
      Anvil/Tools/Storage.pm
  2. 2
      tools/anvil-sync-shared

@ -3531,7 +3531,7 @@ sub push_file
} }
} }
if (not $file_uuid) if ((not $file_uuid) or (not $file_size))
{ {
$file_size = (stat($file))[7]; $file_size = (stat($file))[7];
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => { $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => $debug, list => {
@ -3624,6 +3624,7 @@ sub push_file
's4:adjusted_byptes_sec' => $anvil->Convert->add_commas({number => $adjusted_byptes_sec})." ".$anvil->Words->string({string => "#!string!suffix_0060!#"}), 's4:adjusted_byptes_sec' => $anvil->Convert->add_commas({number => $adjusted_byptes_sec})." ".$anvil->Words->string({string => "#!string!suffix_0060!#"}),
's5:copy_seconds' => $anvil->Convert->add_commas({number => $copy_seconds})." ".$anvil->Words->string({string => "#!string!suffix_0007!#"}), 's5:copy_seconds' => $anvil->Convert->add_commas({number => $copy_seconds})." ".$anvil->Words->string({string => "#!string!suffix_0007!#"}),
's6:say_copy_time' => $say_copy_time, 's6:say_copy_time' => $say_copy_time,
's7:file_size' => $anvil->Convert->bytes_to_human_readable({"bytes" => $file_size}),
}}); }});
my $variables = { my $variables = {
@ -3699,12 +3700,13 @@ sub push_file
} }
# Mark the file as being on this host # Mark the file as being on this host
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { do_host_type => $do_host_type }});
if ($do_host_type ne "striker") if ($do_host_type ne "striker")
{ {
my $file_location_uuid = $anvil->Database->insert_or_update_file_locations({ my $file_location_uuid = $anvil->Database->insert_or_update_file_locations({
debug => 2, debug => 2,
file_location_file_uuid => $file_uuid, file_location_file_uuid => $file_uuid,
file_location_host_uuid => $host_uuid, file_location_host_uuid => $target_host_uuid,
file_location_active => 1, file_location_active => 1,
}); });
$anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { file_location_uuid => $file_location_uuid }}); $anvil->Log->variables({source => $THIS_FILE, line => __LINE__, level => 2, list => { file_location_uuid => $file_location_uuid }});

@ -576,7 +576,7 @@ sub process_incoming_file
# Any hosts not currently online will have a job registered. # Any hosts not currently online will have a job registered.
$anvil->Storage->push_file({ $anvil->Storage->push_file({
debug => 2, debug => 2,
file => $file, file => $target_file,
file_uuid => $file_uuid, file_uuid => $file_uuid,
}); });

Loading…
Cancel
Save