0

Recently we had the error while upgrading flipper gem Removes:dalli_store. Use Rails' official:mem_cache_store instead. https://guides.rubyonrails.org/caching_with_rails.html. So we changed cache store from dalli to mem_cache_store. After upgrade, we are facing an issue with the following code

def self.for_user(user)
   Rails.cache.fetch(data_completeness_cache_key(user.id), expires_in: 10.minutes) do
     return [] unless user.is_a_patient?
      
     cache_compute
   end
end

where cache_compute returns an array of objects.

Stacktrace:

 Minitest::UnexpectedError: ActionView::Template::Error: can't dump File

        appsules/data_completeness/services/calculate_data_completeness.rb:22:in `for_user'

        appsules/data_completeness/services/calculate_data_completeness.rb:32:in `complete_for_user?'

        app/helpers/application_helper.rb:691:in `data_donation_tray_props'

        app/helpers/application_helper.rb:741:in `navbar_props'

        app/views/layouts/_header.html.haml:29

        app/views/layouts/nav.html.haml:20

        app/views/layouts/nav.html.haml:17

        app/controllers/application_controller.rb:276:in `handle_insufficient_privileges'

        app/controllers/application_controller.rb:72:in `block in <class:ApplicationController>'

        test/controllers/api/v3/profiles_controller_test.rb:102:in `block (2 levels) in <class:ProfilesControllerTest>'
    appsules/data_completeness/services/calculate_data_completeness.rb:22:in `for_user'
    appsules/data_completeness/services/calculate_data_completeness.rb:32:in `complete_for_user?'
    app/helpers/application_helper.rb:691:in `data_donation_tray_props'
    app/helpers/application_helper.rb:741:in `navbar_props'
    app/views/layouts/_header.html.haml:29
    app/views/layouts/nav.html.haml:20
    app/views/layouts/nav.html.haml:17
    app/controllers/application_controller.rb:276:in `handle_insufficient_privileges'
    app/controllers/application_controller.rb:72:in `block in <class:ApplicationController>'
    test/controllers/api/v3/profiles_controller_test.rb:102:in `block (2 levels) in <class:ProfilesControllerTest>
Siva Gollapalli
  • 626
  • 6
  • 20
  • Please edit your question to include a full stack trace and error. Please also include the `cache_compute` method an a representative example of its returned data. Always make sure to include enough details in your question so that others can reproduce your issue. – Holger Just Jul 28 '22 at 12:30
  • Added stack trace. I will try to add example as well – Siva Gollapalli Jul 29 '22 at 08:24

0 Answers0