Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/google-app-engine/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Google应用程序引擎API方法响应在正确和错误结果之间完美交替_Java_Google App Engine_Transactions_Eventual Consistency - Fatal编程技术网

Java Google应用程序引擎API方法响应在正确和错误结果之间完美交替

Java Google应用程序引擎API方法响应在正确和错误结果之间完美交替,java,google-app-engine,transactions,eventual-consistency,Java,Google App Engine,Transactions,Eventual Consistency,我目前正在谷歌应用程序引擎上学习udacity课程。 有简介和会议。每个概要文件都可以注册会议,然后将会议添加到概要文件对象中的列表中 现在,当我查看getProfile请求的API资源管理器时,该请求检索当前活动用户的用户数据,经过oAuth2.0验证,每次单击Execute时,我都会得到不同的结果 当我第一次单击execute时,我得到了正确的响应: 回答正确我通过开发者控制台数据存储查询验证了这一点: 200 OK - Show headers - { "displayName":

我目前正在谷歌应用程序引擎上学习udacity课程。 有简介和会议。每个概要文件都可以注册会议,然后将会议添加到概要文件对象中的列表中

现在,当我查看getProfile请求的API资源管理器时,该请求检索当前活动用户的用户数据,经过oAuth2.0验证,每次单击Execute时,我都会得到不同的结果

当我第一次单击execute时,我得到了正确的响应:

回答正确我通过开发者控制台数据存储查询验证了这一点:

200 OK

- Show headers -

{
 "displayName": "matjes993",
 "mainEmail": "matjes993@gmail.com",
 "teeShirtSize": "L",
 "conferenceKeysToAttend": [
  "ag9zfnVkYWNpdHk2MTNuZXdyMwsSB1Byb2ZpbGUiFTExMTAxNDEyMTM0NDI2MTgyNTQwOAwLEgpDb25mZXJlbmNlGJJODA",
  "ag9zfnVkYWNpdHk2MTNuZXdyNAsSB1Byb2ZpbGUiFTExMTAxNDEyMTM0NDI2MTgyNTQwOAwLEgpDb25mZXJlbmNlGLHqAQw"
 ],
 "userId": "111014121344261825408",
 "kind": "conference#resourcesItem",
 "etag": "\"E9X210UxHC5oxQ1CO9nNLV3Nj2U/3Ht-GWsemcXnzWP_cuR_xoRfQxM\""
}
但如果我再次单击execute,我会得到以下响应:

错误反应

如果我再次单击execute,我会再次得到正确的响应,以此类推。它总是在错误和正确之间交替,但数据存储查询中的数据保持不变。这对我来说毫无意义

getProfile方法:

@ApiMethod(name = "getProfile", path = "profile", httpMethod = HttpMethod.GET)
public Profile getProfile(final User user) throws UnauthorizedException {
    if (user == null) {
        throw new UnauthorizedException("Authorization required");
    }

    String userId = user.getUserId();
    Key<Profile> key = Key.create(Profile.class, userId);

    Profile profile =  ofy().load().key(key).now();
    return profile;
}
更新1: 即使是现在,12个小时后,问题仍然存在。我在开发者控制台中看到了正确的数据,但是我的前端和API浏览器总是在正确和错误的结果之间切换。 感觉就像下面有两个不同的数据存储,API调用在它们之间交替进行

更新2: 我将应用程序重新部署到GAE上的一个新项目中,但错误仍在发生。我改变了上面的帖子,因为我现在有一个更简单的例子,当问题发生时

@ApiMethod(name = "getProfile", path = "profile", httpMethod = HttpMethod.GET)
public Profile getProfile(final User user) throws UnauthorizedException {
    if (user == null) {
        throw new UnauthorizedException("Authorization required");
    }

    String userId = user.getUserId();
    Key<Profile> key = Key.create(Profile.class, userId);

    Profile profile =  ofy().load().key(key).now();
    return profile;
}