Skip to content

Commit

Permalink
eliminate dua
Browse files Browse the repository at this point in the history
  • Loading branch information
terrywbrady committed Jan 19, 2024
1 parent d9b77fd commit 01213bd
Show file tree
Hide file tree
Showing 15 changed files with 3 additions and 236 deletions.
1 change: 0 additions & 1 deletion app/controllers/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ def close
end

class ApplicationController < ActionController::Base
include DuaMixin
include Encoder
include ErrorMixin
include NumberMixin
Expand Down
60 changes: 0 additions & 60 deletions app/controllers/dua_controller.rb

This file was deleted.

1 change: 0 additions & 1 deletion app/controllers/file_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,6 @@ def check_download
def check_version
version = @file.inv_version
obj = version.inv_object
check_dua(obj, { object: obj, version: version, file: @file })
end

def not_found_obj
Expand Down
4 changes: 0 additions & 4 deletions app/controllers/help_controller.rb

This file was deleted.

4 changes: 0 additions & 4 deletions app/controllers/object_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@ class ObjectController < ApplicationController
end
end

before_action(only: %i[download download_user presign]) do
check_dua(@object, { object: @object })
end

before_action(only: %i[ingest mint update]) do
if current_user
render(status: 404, plain: '') unless current_user.groups('write').any? { |g| g.submission_profile == params[:profile] }
Expand Down
5 changes: 0 additions & 5 deletions app/controllers/version_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,6 @@ class VersionController < ApplicationController
end
end

before_action(only: %i[download download_user presign]) do
obj = @version.inv_object
check_dua(obj, { object: obj, version: @version })
end

before_action(only: %i[download download_user]) do
if @version.exceeds_download_size?
render file: "#{Rails.root}/public/403.html", status: 403, layout: false
Expand Down
3 changes: 0 additions & 3 deletions app/helpers/dua_helper.rb

This file was deleted.

40 changes: 0 additions & 40 deletions app/lib/dua_mixin.rb

This file was deleted.

16 changes: 0 additions & 16 deletions app/mailers/dua_mailer.rb

This file was deleted.

17 changes: 0 additions & 17 deletions app/models/dua.rb

This file was deleted.

4 changes: 0 additions & 4 deletions app/models/inv_duas.rb

This file was deleted.

14 changes: 0 additions & 14 deletions app/models/inv_object.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ class InvObject < ApplicationRecord
has_many :inv_files, through: :inv_versions

has_many :inv_dublinkernels
has_one :inv_duas
has_one :inv_embargo

has_many :inv_collections_inv_objects
Expand Down Expand Up @@ -57,19 +56,6 @@ def bytestream_uri3
URI.parse("#{APP_CONFIG['uri_3']}#{node_number}/#{to_param}")
end

def dua_exists?
merritt_retry_block do
!inv_duas.blank?
end
end

# :nocov:
def dua_uri
URI.parse("#{APP_CONFIG['uri_1']}#{node_number}/#{inv_collection.to_param}/0/#{urlencode(APP_CONFIG['mrt_dua_file'])}")
end

# :nocov:

def node_number
inv_nodes.where('inv_nodes_inv_objects.role' => 'primary').select('inv_nodes.number').map(&:number).first
end
Expand Down
5 changes: 3 additions & 2 deletions config/database.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ default: &default
encoding: utf8mb4
host: "{!SSM: inv/db-host}"
database: "{!SSM: inv/db-name}"
pool: 20
pool: 25
idle_timeout: 0
port: 3306
username: "{!SSM: inv/readwrite/db-user}"
password: "{!SSM: inv/readwrite/db-password}"
Expand All @@ -34,4 +35,4 @@ docker: &docker
username: user
password: password
encoding: utf8mb4

idle_timeout: 0
51 changes: 0 additions & 51 deletions spec/controllers/dua_controller_spec.rb

This file was deleted.

14 changes: 0 additions & 14 deletions spec/controllers/file_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -198,20 +198,6 @@ def my_presign_wrapper
end.to raise_error(MerrittRetryMixin::RetryException)
end

it 'redirects to presign url for the file - retry dua check' do
mock_permissions_all(user_id, collection_id)

request.session.merge!({ uid: user_id })
allow_any_instance_of(InvObject)
.to receive(:inv_duas)
.with(any_args)
.and_raise(Mysql2::Error::ConnectionError.new('Simulate Failure'))

expect do
get(:presign, params: params)
end.to raise_error(MerrittRetryMixin::RetryException)
end

it 'test ark encoding recovery' do
mock_permissions_all(user_id, collection_id)

Expand Down

0 comments on commit 01213bd

Please sign in to comment.