Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bump mapper version to fix zeitwerk problem #170

Merged
merged 4 commits into from
Jun 23, 2022
Merged
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
6 changes: 3 additions & 3 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ gem 'after_commit_everywhere', '~> 0.1', '>= 0.1.5'
gem 'aws-sdk-s3', require: false
gem 'bulma-rails', '~> 0.9.0'

gem 'collectionspace-client', tag: 'v0.10.0', git: 'https://github.com/collectionspace/collectionspace-client.git'
gem 'collectionspace-refcache', tag: 'v0.7.7', git: 'https://github.com/collectionspace/collectionspace-refcache.git'
gem 'collectionspace-mapper', tag: 'v3.0.0', git: 'https://github.com/collectionspace/collectionspace-mapper.git'
gem 'collectionspace-client', tag: 'v0.14.1', git: 'https://github.com/collectionspace/collectionspace-client.git'
gem 'collectionspace-refcache', tag: 'v1.0.0', git: 'https://github.com/collectionspace/collectionspace-refcache.git'
gem 'collectionspace-mapper', tag: 'v4.0.2', git: 'https://github.com/collectionspace/collectionspace-mapper.git'

gem 'csvlint'
gem 'devise'
Expand Down
20 changes: 10 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
GIT
remote: https://github.com/collectionspace/collectionspace-client.git
revision: b33bbe14b237283699f74fee319ed0b996950ce8
tag: v0.10.0
revision: b1240d71ca95085ece7b3d1f2f067b538ab9eb2f
tag: v0.14.1
specs:
collectionspace-client (0.10.0)
collectionspace-client (0.14.1)
httparty
json
nokogiri

GIT
remote: https://github.com/collectionspace/collectionspace-mapper.git
revision: 7ee69747be0865686d33b872bb038fa39d3baf51
tag: v3.0.0
revision: dca7ffb36794681ef56525b9d7e2de4e2278d3fe
tag: v4.0.2
specs:
collectionspace-mapper (3.0.0)
collectionspace-mapper (4.0.2)
chronic
facets
memo_wise (~> 1.1.0)
Expand All @@ -22,10 +22,10 @@ GIT

GIT
remote: https://github.com/collectionspace/collectionspace-refcache.git
revision: 25194130156f4d92bb795bbf1227cf792e906726
tag: v0.7.7
revision: ade17428230a7b3d3d05d7384975d71bc866711f
tag: v1.0.0
specs:
collectionspace-refcache (0.7.7)
collectionspace-refcache (1.0.0)
redis (~> 4.2.1)
zache (~> 0.12.0)

Expand Down Expand Up @@ -208,7 +208,7 @@ GEM
actionview (>= 5.0.0)
activesupport (>= 5.0.0)
jmespath (1.6.1)
json (2.6.1)
json (2.6.2)
listen (3.7.1)
rb-fsevent (~> 0.10, >= 0.10.3)
rb-inotify (~> 0.9, >= 0.9.10)
Expand Down
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,11 +78,14 @@ Environment:

The `REDIS_URL` can be set on a per cache basis using:

- REDIS_CABLE_URL # websockets
- REDIS_CACHE_URL # rails cache
- REDIS_REFCACHE_URL # refcache
- REDIS_SESSION_URL # rails sessions
- REDIS_SIDEKIQ_URL # background jobs
- REDIS_CABLE_URL # (1) websockets
- REDIS_CACHE_URL # (0) rails cache
- REDIS_CSIDCACHE_URL # (5) csidcache - (CSID lookup for searching for relations, via `CollectionSpace::RefCache`)
- REDIS_REFCACHE_URL # (3) refcache - (refname lookup for authority and vocabulary terms, via `CollectionSpace::RefCache`)
- REDIS_SESSION_URL # (4) rails sessions
- REDIS_SIDEKIQ_URL # (2) background jobs

The numbers in parentheses indicate the Redis database used by default in the Redis URL

For development only:

Expand Down
6 changes: 5 additions & 1 deletion app/models/batch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,11 @@ def fingerprint
def handler
@rm ||= fetch_mapper
CollectionSpace::Mapper::DataHandler.new(
record_mapper: @rm, client: connection.client, cache: connection.refcache, config: batch_config
record_mapper: @rm,
client: connection.client,
cache: connection.refcache,
csid_cache: connection.csidcache,
config: batch_config
)
end

Expand Down
15 changes: 10 additions & 5 deletions app/models/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -40,17 +40,22 @@ def primary?
primary
end

def csidcache
@csidcache_config ||= {
redis: Rails.configuration.csidcache_url,
domain: client.config.base_uri,
lifetime: 5 * 60,
}
CollectionSpace::RefCache.new(config: @csidcache_config)
end

def refcache
@cache_config ||= {
redis: Rails.configuration.refcache_url,
domain: client.config.base_uri,
error_if_not_found: false,
lifetime: 5 * 60,
search_delay: 5 * 60,
search_enabled: true,
search_identifiers: false
}
CollectionSpace::RefCache.new(config: @cache_config, client: client)
CollectionSpace::RefCache.new(config: @cache_config)
end

def unset_primary
Expand Down
4 changes: 4 additions & 0 deletions config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ class Application < Rails::Application
ENV.fetch('REDIS_URL', 'redis://localhost:6379/3')
end

config.csidcache_url = ENV.fetch('REDIS_CSIDCACHE_URL') do
ENV.fetch('REDIS_URL', 'redis://localhost:6379/5')
end

config.superuser_email = ENV.fetch(
'SUPERUSER_EMAIL', 'superuser@collectionspace.org'
)
Expand Down
9 changes: 9 additions & 0 deletions test/models/connection_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -58,4 +58,13 @@ class ConnectionTest < ActiveSupport::TestCase
assert_not(c1.primary?)
assert(c2.primary?)
end

test 'can return RefCache and CSIDCache on two different Redis DBs' do
conn = connections(:core_superuser)
refcache = conn.refcache
assert(refcache.is_a?(CollectionSpace::RefCache))
csidcache = conn.csidcache
assert(csidcache.is_a?(CollectionSpace::RefCache))
assert(csidcache.config[:redis] != refcache.config[:redis])
end
end