Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

Merged
merged 12 commits into from
Sep 11, 2020
Merged

feat: add GAE memorystore migration sample #4427

merged 12 commits into from
Sep 11, 2020

Conversation

engelke
Copy link
Contributor

@engelke engelke commented Aug 3, 2020

Description

Fixes feature request b/162527128

Note: It's a good idea to open an issue first for discussion.

Checklist

@engelke engelke requested a review from a team as a code owner August 3, 2020 21:34
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Aug 3, 2020
@tmatsuo
Copy link
Contributor

tmatsuo commented Aug 3, 2020

@engelke Thanks, can you update the PR title? Maybe add memorystore migration sample or sth?

@ace-n ace-n changed the title Memstore feat: add GAE memorystore migration sample Aug 4, 2020
Copy link

@ace-n ace-n left a 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)
Copy link

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?

Copy link
Contributor Author

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.

Copy link

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. 🙁

Copy link
Contributor

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?

@engelke engelke requested a review from busunkim96 August 10, 2020 21:14

def increment_counter(name, expires=60, value=0):
# Atomically increment an integer value.
## memcache.set(key="counter", value=0)
Copy link
Contributor

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:
Copy link
Contributor

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?

Copy link
Contributor Author

@engelke engelke Aug 10, 2020

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.

Copy link
Contributor Author

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.

@product-auto-label product-auto-label bot added the samples Issues that are directly related to samples. label Aug 21, 2020
@tmatsuo
Copy link
Contributor

tmatsuo commented Sep 9, 2020

@busunkim96 Does it look good now?

@busunkim96
Copy link
Contributor

@tmatsuo Yep! Thank you for the nudge

@tmatsuo tmatsuo merged commit 6dfc849 into master Sep 11, 2020
@tmatsuo tmatsuo deleted the memstore branch September 11, 2020 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla: yes This human has signed the Contributor License Agreement. samples Issues that are directly related to samples.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants