forked from omniauth/omniauth
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Change Builder from a class to a module and only build app once
Previously, OmniAuth::Builder was a subclass of Rack::Builder. Rack::Builder#call calls #to_app, rebuilding the Rack application on each request, and, as it says in the Rack::Builder comments, this may have a negative impact on performance. This commit changes OmniAuth::Builder from a class to a module and defines a ::new method that extends a Rack::Builder instance with that module, instance_evals any block, and returns the value of #to_app, the built application. Using OmniAuth::Builder will now only build the application once. For users who have been subclassing OmniAuth::Builder, a fix would be subclassing Rack::Builder directly and including OmniAuth::Builder: class MyBuilder < Rack::Builder include OmniAuth::Builder # ... end Resolves omniauth#1083.
- Loading branch information
Showing
2 changed files
with
44 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters