Skip to content

Added config library timestamp check to dynamic definition cache invalidation - fixes #523#1024

Open
philayres wants to merge 1 commit intoconsected:developfrom
hmsrc:config-library-cache-check-523
Open

Added config library timestamp check to dynamic definition cache invalidation - fixes #523#1024
philayres wants to merge 1 commit intoconsected:developfrom
hmsrc:config-library-cache-check-523

Conversation

@philayres
Copy link
Copy Markdown
Contributor

Summary

Fixes #523. Dynamic definitions now detect YAML config library changes via up_to_date? / refresh_outdated, ensuring stale cached configurations are refreshed across all servers and delayed_job workers.

Changes

app/models/dynamic/def_handler.rb

  • latest_stored_update now queries MAX(updated_at) from both definition tables and config_libraries WHERE format = 'yaml', returning the greater value
  • up_to_date? tracks @config_library_only_change to distinguish config-library-only changes from definition changes

app/models/dynamic/def_generator.rb

  • refresh_outdated handles config-library-only changes by calling force_option_config_parse on definitions with # @library references — skipping full model regeneration

app/jobs/application_job.rb

  • Added Application.refresh_dynamic_defs before block.call in around_perform so delayed_job workers detect config library changes

spec/models/dynamic/config_library_cache_invalidation_spec.rb (new)

  • 10 tests covering all 8 acceptance criteria (AC1–AC8)

Acceptance Criteria Coverage

AC Description Covered
AC1 refresh_outdated detects config library changes
AC2 up_to_date? incorporates config library timestamps
AC3 Only force_option_config_parse (not full regen)
AC4 Only dependent definitions refreshed
AC5 Works in multi-server cluster
AC6 ApplicationJob calls refresh_dynamic_defs
AC7 No regression on direct definition edits
AC8 Minimal performance impact (≤3 queries)

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.

Cache check for changed dynamic definitions should also include a "last updated" check on yaml config libraries

1 participant