Skip to content

Commit

Permalink
Merge pull request #8 from collectiveidea/fix-thread-safety-issue
Browse files Browse the repository at this point in the history
Fix thread safety error with handlers
  • Loading branch information
danielmorrison authored Jul 31, 2023
2 parents b213d2a + 7979b71 commit 2b9a947
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/twirp/rails/dispatcher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module Twirp
module Rails
class Dispatcher
def initialize(service_class)
@service_handler = "#{service_class.service_name}Handler".constantize.new
@service_handler = "#{service_class.service_name}Handler".constantize
end

def respond_to_missing?(method, *)
Expand All @@ -14,7 +14,7 @@ def respond_to_missing?(method, *)
def method_missing(name, *args)
request = args[0]
env = args[1]
@service_handler.process(name, request, env)
@service_handler.new.process(name, request, env)
end
end
end
Expand Down

0 comments on commit 2b9a947

Please sign in to comment.