-
Notifications
You must be signed in to change notification settings - Fork 6.6k
feat: add GAE memorystore migration sample #4427
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@engelke Thanks, can you update the PR title? Maybe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM other than a few nits.
(Not a memorystore/Redis expert though, so you might want to find one to review this.)
|
||
def increment_counter(name, expires=60, value=0): | ||
# Atomically increment an integer value. | ||
## memcache.set(key="counter", value=0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: I take it these memcache
comments are supposed to be here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, they show how the older Python 2.7 memcache sample code worked, next to the new code that is functionally similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps putting the Python 2.7 code snippets in a separate block (with a comment at the top explaining their purpose) would be easier to understand at a glance?
Either way - I don't feel strongly about this, so I'll leave it up to you. 🙁
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was also caught off guard by this. Will the purpose of the commented out code be clear from the surrounding documentation?
|
||
def increment_counter(name, expires=60, value=0): | ||
# Atomically increment an integer value. | ||
## memcache.set(key="counter", value=0) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was also caught off guard by this. Will the purpose of the commented out code be clear from the surrounding documentation?
def test_get_data_not_present(query_fn, testbed): | ||
try: | ||
main.client.set(KEY_PREFIX + 'counter', '0', 9000) | ||
except Exception: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a more specific exception that can be used here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It could be redis.RedisError, which all other Redis errors inherit from. I've changed it, but the only purpose of it here is to skip the test in the fairly common situation that Redis isn't set up in the test environment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The double quotes are exact lines from the App Engine standard for Python 2.7 memcache sample code. They're put there to contrast the old and new ways. This is described in the block comments in the code. I also just added mention of that to the README.md.
@busunkim96 Does it look good now? |
@tmatsuo Yep! Thank you for the nudge |
Description
Fixes feature request b/162527128
Note: It's a good idea to open an issue first for discussion.
Checklist
nox -s py-3.6
(see Test Environment Setup)nox -s lint
(see Test Environment Setup)