-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Load redis data once and only once per request * Cache all redis data into the local instance * Remove warm_caches function as it does nothing * Added more verbose logging with performance profiling data * added redis read timer to logging
- Loading branch information
Victor Ng
authored
Sep 2, 2020
1 parent
b33a1b6
commit 4badf3f
Showing
13 changed files
with
217 additions
and
138 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# This Source Code Form is subject to the terms of the Mozilla Public | ||
# License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
# You can obtain one at http://mozilla.org/MPL/2.0/. | ||
|
||
import contextlib | ||
import time | ||
|
||
|
||
@contextlib.contextmanager | ||
def log_timer_debug(msg, logger): | ||
start_time = time.time() | ||
try: | ||
yield | ||
finally: | ||
end_time = time.time() | ||
logger.debug(msg + f" Completed in {end_time-start_time} seconds") | ||
|
||
|
||
@contextlib.contextmanager | ||
def log_timer_info(msg, logger): | ||
start_time = time.time() | ||
try: | ||
yield | ||
finally: | ||
end_time = time.time() | ||
logger.info(msg + f" Completed in {end_time-start_time} seconds") |
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
Oops, something went wrong.