Пример #1
0
    def update(id, add, delay=0):
        entity = yield SomeKind.get_by_id_async(id)
        foo = entity.foo
        foo += add

        yield ndb.sleep(delay)
        entity.foo = foo

        yield entity.put_async()
Пример #2
0
 def callback():
     transaction = ndb.get_context().transaction
     yield ndb.sleep(delay)
     assert ndb.get_context().transaction == transaction
     raise ndb.Return(transaction)