Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions app/models/archive_file.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def request_for_staging?(request_status = status)

# used for :notice and :alert messages in controller flash
def flash_message(current_status = status)
description_for(method: :flash_message, lookup_status: current_status, lookup_hash: Settings.archive_api.flash_messages.to_hash.with_indifferent_access)
description_for_status(method: :flash_message, lookup_status: current_status, lookup_hash: Settings.archive_api.flash_messages.to_hash.with_indifferent_access)
end

# requests staging (if available and not requested yet)
Expand Down Expand Up @@ -193,7 +193,7 @@ def status_request
# if not yet staged: requests for staging (if possible)
# @return Hash
def stage_request!(request_hash = {})
Rails.logger.warn("Staging request for #{archive_url} made in status: #{status}") if staged? # log :staged_without_request cases
staged_request_warn
if block_new_jobs?
log_denied_attempt!(request_hash: request_hash.merge({ reason: 'block_new_jobs' }))
{ status: request_hash[:status], action: :throttled, message: display_status(:too_many_requests), alert: true }
Expand All @@ -203,6 +203,10 @@ def stage_request!(request_hash = {})
end
end

def staged_request_warn
Rails.logger.warn("Staging request for #{archive_url} made in status: #{status}") if staged? # log :staged_without_request cases
end

def job_file_path
@job_file_path ||= "#{local_path}.datacore.yml"
end
Expand Down
4 changes: 2 additions & 2 deletions app/models/archive_file_worker.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def self.too_much_space_used?
def self.block_new_jobs?
too_many_jobs? || too_much_space_used?
end
delegate :bloack_new_jobs?, to: :class
delegate :block_new_jobs?, to: :class

def process_file
# if the file is not currently open by another process
Expand Down Expand Up @@ -195,7 +195,7 @@ def file_path
end

def path
file_path = '.datacore.yml'
file_path + '.datacore.yml'
end

def curl_command(output: false)
Expand Down
11 changes: 11 additions & 0 deletions spec/models/application_record_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
require 'rails_helper'

RSpec.describe ApplicationRecord do

describe "#self.abstract_class" do
it "returns true" do
expect(ApplicationRecord.abstract_class).to eq true
end
end

end
Loading