Class: ForestLiana::ScopesController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/forest_liana/scopes_controller.rb

Instance Method Summary collapse

Instance Method Details

#invalidate_scope_cacheObject



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'app/controllers/forest_liana/scopes_controller.rb', line 3

def invalidate_scope_cache
  begin
    rendering_id = params[:renderingId]

    unless rendering_id
      FOREST_LOGGER.error 'Missing renderingId'
      return render serializer: nil, json: { status: 400 }, status: :bad_request
    end

    ForestLiana::ScopeManager.invalidate_scope_cache(rendering_id)
    return render serializer: nil, json: { status: 200 }, status: :ok
  rescue => error
    FOREST_REPORTER.report error
    FOREST_LOGGER.error "Error during scope cache invalidation: #{error.message}"
    render serializer: nil, json: {status: 500 }, status: :internal_server_error
  end
end