diff --git a/lib/pushmi_pullyu/aip/downloader.rb b/lib/pushmi_pullyu/aip/downloader.rb index a0b4f2e..e017889 100644 --- a/lib/pushmi_pullyu/aip/downloader.rb +++ b/lib/pushmi_pullyu/aip/downloader.rb @@ -151,6 +151,7 @@ def make_file_set_directories(file_set_uuid) def clean_directories return unless File.exist?(@aip_directory) + PushmiPullyu.logger.debug("#{@noid}: Nuking directories ...") FileUtils.rm_rf(@aip_directory) end diff --git a/lib/pushmi_pullyu/aip/fedora_fetcher.rb b/lib/pushmi_pullyu/aip/fedora_fetcher.rb index b34d8df..aa06177 100644 --- a/lib/pushmi_pullyu/aip/fedora_fetcher.rb +++ b/lib/pushmi_pullyu/aip/fedora_fetcher.rb @@ -46,6 +46,7 @@ def download_object(download_path, url_extra: nil, return true elsif response.is_a?(Net::HTTPNotFound) raise FedoraFetchError unless optional + return false else raise FedoraFetchError diff --git a/lib/pushmi_pullyu/aip/file_list_creator.rb b/lib/pushmi_pullyu/aip/file_list_creator.rb index 85e4f77..5a1c329 100644 --- a/lib/pushmi_pullyu/aip/file_list_creator.rb +++ b/lib/pushmi_pullyu/aip/file_list_creator.rb @@ -53,6 +53,7 @@ def extract_list_source_uuids break if next_proxy.nil? raise NextPreviousProxyMismatch if this_proxy != find_prev_proxy(next_proxy) + this_proxy = next_proxy end @@ -76,6 +77,7 @@ def find_first_proxy first_uri = statement.object # Validate that the first proxy doesn't have a previous one raise FirstProxyHasPrev, @uri.to_s if find_prev_proxy(first_uri) + return first_uri end raise NoFirstProxyFound, @uri.to_s @@ -86,6 +88,7 @@ def find_last_proxy last_uri = statement.object # Validate that the last proxy doesn't have a next one raise LastProxyHasNext, @uri.to_s if find_next_proxy(last_uri) + return last_uri end raise LastProxyFound, @uri.to_s diff --git a/lib/pushmi_pullyu/aip/owner_email_editor.rb b/lib/pushmi_pullyu/aip/owner_email_editor.rb index c50506d..9c25124 100644 --- a/lib/pushmi_pullyu/aip/owner_email_editor.rb +++ b/lib/pushmi_pullyu/aip/owner_email_editor.rb @@ -11,6 +11,7 @@ def initialize(rdf_string) end def run + setup_db_connection is_modified = false prefixes = nil # Read once to load prefixes (the @things at the top of an n3 file) @@ -32,7 +33,18 @@ def run end end return new_body if is_modified + raise NoOwnerPredicate end + private + + def setup_db_connection + ActiveRecord::Base.establish_connection(database_configuration) + end + + def database_configuration + PushmiPullyu.options[:database][:url] + end + end diff --git a/lib/pushmi_pullyu/cli.rb b/lib/pushmi_pullyu/cli.rb index 48c9c9e..a7faf04 100644 --- a/lib/pushmi_pullyu/cli.rb +++ b/lib/pushmi_pullyu/cli.rb @@ -48,7 +48,6 @@ def start_server setup_signal_traps setup_log - setup_db_connection print_banner run_tick_loop @@ -276,12 +275,4 @@ def start_server_as_daemon end end - def setup_db_connection - ActiveRecord::Base.establish_connection(database_configuration) - end - - def database_configuration - PushmiPullyu.options[:database][:url] - end - end diff --git a/lib/pushmi_pullyu/preservation_queue.rb b/lib/pushmi_pullyu/preservation_queue.rb index 6d05363..d3cdc13 100644 --- a/lib/pushmi_pullyu/preservation_queue.rb +++ b/lib/pushmi_pullyu/preservation_queue.rb @@ -63,6 +63,7 @@ def wait_next_item while PushmiPullyu.continue_polling? element = next_item return element if element.present? + sleep @poll_interval end end diff --git a/lib/pushmi_pullyu/version.rb b/lib/pushmi_pullyu/version.rb index 6dea00a..670621d 100644 --- a/lib/pushmi_pullyu/version.rb +++ b/lib/pushmi_pullyu/version.rb @@ -1,3 +1,3 @@ module PushmiPullyu - VERSION = '1.0.4'.freeze + VERSION = '1.0.5'.freeze end