Skip to content
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
1 change: 1 addition & 0 deletions config/application.yml.default
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ redis_irs_attempt_api_url: redis://localhost:6379/2
redis_throttle_url: redis://localhost:6379/1
redis_url: redis://localhost:6379/0
redis_pool_size: 10
redis_session_pool_size: 10
redis_throttle_pool_size: 5
reg_confirmed_email_max_attempts: 20
reg_confirmed_email_window_in_minutes: 60
Expand Down
7 changes: 7 additions & 0 deletions config/initializers/redis.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,10 @@
redis: Redis.new(url: IdentityConfig.store.redis_throttle_url),
)
end

REDIS_SESSION_POOL_WRAPPER = ConnectionPool::Wrapper.new(
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was on the fence about defining this here vs in session_store.rb

Pros:

  • it's a consistent spot we define all our pools

Cons:

  • relies on alphabetical ordering of initializers

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I kinda like it being in session_store.rb, because it keeps all the session_store stuff in one place, but I don't feel strongly about that.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's true! But as a counterpoint, we missed one of our redis connection pools in this other PR because it wasn't defined in the same place: #7283 (comment)

size: IdentityConfig.store.redis_session_pool_size,
) do
# redis-session-store does its own namespacing in session_store.rb
Redis.new(url: IdentityConfig.store.redis_url)
end
2 changes: 1 addition & 1 deletion config/initializers/session_store.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
ttl: IdentityConfig.store.session_timeout_in_minutes.minutes,

key_prefix: "#{IdentityConfig.store.domain_name}:session:",
url: IdentityConfig.store.redis_url,
client: REDIS_SESSION_POOL_WRAPPER,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

next steps: fork session store gem to be able to use a connection pool directly

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
on_session_load_error: SessionEncryptorErrorHandler,
serializer: SessionEncryptor.new,
Expand Down
1 change: 1 addition & 0 deletions lib/identity_config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,7 @@ def self.build_store(config_map)
config.add(:redis_throttle_url)
config.add(:redis_url)
config.add(:redis_pool_size, type: :integer)
config.add(:redis_session_pool_size, type: :integer)
config.add(:redis_throttle_pool_size, type: :integer)
config.add(:reg_confirmed_email_max_attempts, type: :integer)
config.add(:reg_confirmed_email_window_in_minutes, type: :integer)
Expand Down