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

Only check for solr alias changes on a timer #211

Merged
merged 2 commits into from
Oct 21, 2024
Merged

Conversation

billdueber
Copy link
Collaborator

The implementation of solr_cloud-connection is purposefully chatty, not caching anything because during the admin cycle, you want to see your changes reflected immediatley and the number of operations is generally small.

My use of uncached values (checking the name of the collection underlying an alias) on what turned out to be basically every call was disastrous.

This PR creates an instance of Concurrent::TimerTask that runs the check, and updates if needed, every 20 seconds.

Notable changes are:

  • All the logic about updates is moved into config/initializers/solr_admin_cache.rb
  • The formerly-recursive method of determining the underlying collection name (because it's legal, in general, to have aliass that point to other aliases) has been removed, since we just don't need it.
  • The cached values are stored in Concurrent::Atom instances in the Services module with everything else
  • load_local_config.rb basically just calls #value on the Services values.
  • The footer now shows, ridiculously, the time down to the second. This is purely to make testing easier, because seeing a change in the footer date is an easy way to know the change has been made.

The implementation of `solr_cloud-connection` is purposefully chatty,
not caching anything because during the admin cycle, you want to see your
changes reflected immediatley and the number of operations is generally small.

My use of uncached values (checking the name of the collection underlying an
alias) on what turned out to be basically every call was disastrous.

This PR creates an instance of [Concurrent::TimerTask](https://ruby-concurrency.github.io/concurrent-ruby/master/Concurrent/TimerTask.html) that runs the check,
and updates if needed, every 20 seconds.

 Notable changes are:
   * All the logic about updates is moved into `config/initializers/solr_admin_cache.rb`
   * The formerly-recursive method of determining the underlying collection name (because it's legal,
     in general, to have aliass that point to other aliases) has been removed, since we just don't need it.
   * The cached values are stored in `Concurrent::Atom` instances in the Services module with everything else
   * `load_local_config.rb` basically just calls `#value` on the Services values.
   * The footer now shows, ridiculously, the time down to the second. This is purely to make testing easier,
     because seeing a change in the footer date is an easy way to know the change has been made.
@billdueber billdueber merged commit 359d504 into main Oct 21, 2024
0 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant