且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

ndb异步保证在应用程序请求完成后执行?

更新时间:2023-11-30 10:23:34


如果应用程序请求在ndb请求完成之前完成,ndb请求是否仍能保证完成?

If an application request has finished before the ndb request finishes, would the ndb request still be guaranteed to finish?

没有。

No.


这是否意味着无论用户是否关心结果,都需要调用future.get_result无论如何,只是为了确保ndb请求执行?

Does this mean that regardless of whether a user care about the result, future.get_result needs to be called anyway just to make sure the ndb request is performed?

基本上可以,但是您可以使用ndb.toplevel装饰器以方便使用你不必等待明确的结果。也就是说,我认为这不是您想要的。

Basically yes, but you can use ndb.toplevel decorator for the convenience so that you don't have to wait for the result explicitly. That said, I don't think this is what you want.

可能 taskqueue 是你想要的。请检查出来。

Probably taskqueue is what you want. Please check it out.