Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion lib/app_profiler/server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,12 @@ def start_running(stackprof_args)

@profile_running = true

AppProfiler.start(**stackprof_args)
AppProfiler.start(**stackprof_args).tap do |started|
@profile_running = false unless started
end
rescue
@profile_running = false
raise
end
end

Expand Down
13 changes: 13 additions & 0 deletions test/app_profiler/profile_server_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -353,6 +353,19 @@ def app
AppProfiler.stop
end

test "app can start profiling again after external conflict clears" do
begin
AppProfiler.start
get("/profile?duration=0.01")
assert_equal(decode_status(last_response.status), Net::HTTPConflict)
ensure
AppProfiler.stop
end

get("/profile?duration=0.01")
assert(last_response.ok?)
end

private

def with_profiled_workload(workload, &block)
Expand Down