Skip to content

Commit

Permalink
update tests, statics
Browse files Browse the repository at this point in the history
  • Loading branch information
rmosolgo committed Feb 19, 2025
1 parent 6ef72dc commit a72de98
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 6 deletions.
14 changes: 10 additions & 4 deletions lib/graphql/dashboard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,16 @@ def destroy
end

class StaticsController < ApplicationController
STATICS = {
"icon.png" => File.expand_path("../dashboard/statics/icon.png", __FILE__),
"header-icon.png" => File.expand_path("../dashboard/statics/header-icon.png", __FILE__),
}
# Use an explicit list of files to avoid any chance of reading other files from disk
STATICS = {}

[
"icon.png",
"header-icon.png"
].each do |static_file|
STATICS[static_file] = File.expand_path("../dashboard/statics/#{static_file}", __FILE__)
end

def show
expires_in 1.year, public: true
if (filepath = STATICS[params[:id]])
Expand Down
2 changes: 1 addition & 1 deletion lib/graphql/tracing/perfetto_trace.rb
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ def end_execute_multiplex(m)
track_uuid: fid,
)
unsubscribe_from_active_support_notifications
if m.context[:trace_mode] == @save_trace_mode
if @save_trace_mode && m.context[:trace_mode] == @save_trace_mode
duration_ms = (Time.now.to_f - @begin_time.to_f) * 1000
m.schema.perfetto_sampler.save_trace(@operation_name, duration_ms, @begin_time, Trace.encode(Trace.new(packet: @packets)))
end
Expand Down
2 changes: 1 addition & 1 deletion spec/graphql/autoload_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def self.eager_load!
describe "loading nested files in the repo" do
it "can load them individually" do
files_to_load = Dir.glob("lib/**/tracing/*.rb")
assert_equal 27, files_to_load.size, "It found all the expected files"
assert_equal 28, files_to_load.size, "It found all the expected files"
files_to_load.each do |file|
require_path = file.sub("lib/", "").sub(".rb", "")
stderr_and_stdout, _status = Open3.capture2e("ruby -Ilib -e 'require \"#{require_path}\"'")
Expand Down

0 comments on commit a72de98

Please sign in to comment.