Skip to content

Commit

Permalink
Removing cache for NDB so that only datastore is timed.
Browse files Browse the repository at this point in the history
Also differentiating logging statements for gcloud-python
and NDB saves.
  • Loading branch information
dhermes committed Jan 9, 2015
1 parent 709852e commit 6b85e80
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions application/main.py
Expand Up @@ -24,6 +24,9 @@


class Foo(ndb.Model):
_use_memcache = False
_use_cache = False

now = ndb.DateTimeProperty(auto_now_add=True)
nickname = ndb.BlobProperty(indexed=True)
email = ndb.BlobProperty(indexed=True)
Expand All @@ -39,7 +42,8 @@ def make_entity(user):
start = time.time()
entity.save()
duration = time.time() - start
logging.debug('Saving %r took %f seconds.', entity.key(), duration)
logging.debug('Saving with gcloud-python %r took %f seconds.',
entity.key(), duration)
return entity


Expand All @@ -50,8 +54,8 @@ def make_ndb_entity(user):
start = time.time()
foo_entity.put()
duration = time.time() - start
logging.debug('Saving %r took %f seconds.', foo_entity.key,
duration)
logging.debug('Saving with NDB %r took %f seconds.',
foo_entity.key, duration)
return foo_entity


Expand Down

0 comments on commit 6b85e80

Please sign in to comment.