Skip to content

Commit

Permalink
Fix linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jkeen committed Mar 27, 2024
1 parent fe50f7d commit 989793a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 12 deletions.
5 changes: 1 addition & 4 deletions lib/graphiti/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class Configuration
attr_reader :debug, :debug_models

attr_writer :schema_path
attr_writer :cache_rendering

# Set defaults
# @api private
Expand Down Expand Up @@ -63,10 +64,6 @@ def cache_rendering?
end
end

def cache_rendering=(val)
@cache_rendering = val
end

def schema_path
@schema_path ||= raise("No schema_path defined! Set Graphiti.config.schema_path to save your schema.")
end
Expand Down
6 changes: 3 additions & 3 deletions lib/graphiti/debugger.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,10 @@ def on_render(name, start, stop, id, payload)

Graphiti::Util::CacheDebug.new(payload[:proxy]).analyze do |cache_debug|
logs << ["Cache key for #{cache_debug.name}", :blue, true]
if cache_debug.volatile?
logs << [" \\_ volatile | Request count: #{cache_debug.request_count} | Hit count: #{cache_debug.hit_count}", :red, true]
logs << if cache_debug.volatile?
[" \\_ volatile | Request count: #{cache_debug.request_count} | Hit count: #{cache_debug.hit_count}", :red, true]
else
logs << [" \\_ stable | Request count: #{cache_debug.request_count} | Hit count: #{cache_debug.hit_count}", :blue, true]
[" \\_ stable | Request count: #{cache_debug.request_count} | Hit count: #{cache_debug.hit_count}", :blue, true]
end

if cache_debug.changed_key?
Expand Down
7 changes: 2 additions & 5 deletions lib/graphiti/util/cache_debug.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def key
end

def current_version
@current_version ||= {
@current_version ||= {
cache_key: proxy.cache_key_with_version,
version: proxy.updated_at,
expires_in: proxy.cache_expires_in,
Expand Down Expand Up @@ -50,10 +50,7 @@ def hit_count

def change_percentage
return 0 if request_count == 0

(miss_count.to_i / request_count.to_f * 100).round(1)
rescue Exception => e
puts e.inspect
end

def volatile?
Expand Down Expand Up @@ -88,4 +85,4 @@ def save
end
end
end
end
end

0 comments on commit 989793a

Please sign in to comment.