forked from sparckles/Robyn
-
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.
refactor: openApi made lazy. (sparckles#1066)
* refactor: openApi made lazy. This is a staging post so there are extra tests (in all the decorators). Fixes a potential issue in __init__ where the default argument creates a shared object at parse time rather than a separate one for each instance. As only one instance, not normally an issue but not good practice. One FIXME is an edge case in init_openapi where neither if clause evaluates to True for openapi_file_path (should we log an error or what?) * refactor: openApi made lazy. All add_route methods have auth_required, openapi_name and openapi_tags which get stored in the route. Instead of incrementally adding them to openapi routes they are added all at once in app.start include_routes now additionally tracks the list of routers whose routes have been added to the main app. This will be used more later to avoid merging routes until app.start for more flexibility * refactor: try to solve the speed issue by improving handling moving from allowing None for openApi_tags to not * refactor: slightly optimised lower_http_method I've tested with 100,000 loops. This is marginally faster. This PR lowers slows full test suite by 0.004s on my system. However, those benchmarks are mostly setup. Once we are making calls to a running server none of this code is being executed. * refactor: remove extra Robyn instance variable to avoid extra side effects in the future. No consistent peformance impact on 100,000 Robyn(__file__) calls
- Loading branch information
Showing
3 changed files
with
68 additions
and
35 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
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