Skip to content

Commit

Permalink
Avoid trying to acquire lock twice when shutting down (#3036)
Browse files Browse the repository at this point in the history
  • Loading branch information
vinistock authored Jan 10, 2025
1 parent 6e90780 commit a49104e
Showing 1 changed file with 3 additions and 7 deletions.
10 changes: 3 additions & 7 deletions lib/ruby_lsp/base_server.rb
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,7 @@ def start
@writer.write(Result.new(id: message[:id], response: nil).to_hash)
end
when "exit"
@global_state.synchronize do
status = @incoming_queue.closed? ? 0 : 1
send_log_message("Shutdown complete with status #{status}")
exit(status)
end
@global_state.synchronize { exit(@incoming_queue.closed? ? 0 : 1) }
else
@incoming_queue << message
end
Expand All @@ -119,8 +115,8 @@ def run_shutdown
@outgoing_queue.close
@cancelled_requests.clear

@worker.join
@outgoing_dispatcher.join
@worker.terminate
@outgoing_dispatcher.terminate
@store.clear
end

Expand Down

0 comments on commit a49104e

Please sign in to comment.