简体   繁体   English

Google Appengine数据存储超时异常

[英]Google Appengine Datastore Timeout Exception

We are fetching the list of namespaces from datastore which counts upto 30k. 我们正在从最多30k的数据存储中获取名称空间列表。

The cron to fetch namespaces runs daily. 提取名称空间的cron每天运行。 But one day it works fine and other day it throws datastore timeout exception. 但是有一天它可以正常工作,而另一天它会抛出数据存储超时异常。

com.google.appengine.api.datastore.DatastoreTimeoutException: The datastore operation timed out, or the data was temporarily unavailable. com.google.appengine.api.datastore.DatastoreTimeoutException:数据存储操作超时,或者数据暂时不可用。

Related Code : 相关代码:

DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
FetchOptions options = FetchOptions.Builder.withChunkSize(150);
Query q = new Query(Entities.NAMESPACE_METADATA_KIND);

for (Entity e : ds.prepare(q).asIterable(options)){
   // A nonzero numeric id denotes the default namespace;
   // see Namespace Queries, below
   if (e.getKey().getId() != 0){
      continue;
   }else{
      namespaces.add(e.getKey().getName());
   }
}

What could be the issue? 可能是什么问题?

According to official documentation: 根据官方文件:

DatastoreTimeoutException is thrown when a datastore operation times out. 数据存储操作超时时,将引发DatastoreTimeoutException。 This can happen when you attempt to put, get, or delete too many entities or an entity with too many properties, or if the datastore is overloaded or having trouble. 当您尝试放置,获取或删除太多实体或具有太多属性的实体,或者数据存储区过载或出现问题时,可能会发生这种情况。

This means that datastore having troubles with your request. 这意味着数据存储在处理您的请求时遇到麻烦。 Try to handle that error like: 尝试处理该错误,例如:

import com.google.appengine.api.datastore.DatastoreTimeoutException;    
    try {
      // Code that could result in a timeout
    } catch (DatastoreTimeoutException e) {
      // Display a timeout-specific error page
    }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Google AppEngine:了解数据存储区交易 - Google AppEngine: understanding datastore transactions Google AppEngine密钥异常 - Google AppEngine Key exception google appengine datastore.get(key)是否一致? - is google appengine datastore.get(key) consistent? 为存储在Google Appengine数据存储区中的实体创建URL - Creating URLs for entities stored on the Google Appengine datastore AppEngine ClassNotFoundException:com.google.appengine.api.datastore.DatastoreServiceFactory - AppEngine ClassNotFoundException: com.google.appengine.api.datastore.DatastoreServiceFactory 是否可以增加Google Cloud Datastore请求的超时时间? - Is it possible to increase the timeout for Google Cloud Datastore requests? com.google.appengine.api.datastore.DatastoreNeedIndexException:找不到匹配的索引 - com.google.appengine.api.datastore.DatastoreNeedIndexException: no matching index found com.google.appengine.api.datastore.DatastoreFailureException:意外失败 - com.google.appengine.api.datastore.DatastoreFailureException: Unexpected failure 示例应用中的com.google.appengine.api.datastore.DatastoreNeedIndexException错误 - com.google.appengine.api.datastore.DatastoreNeedIndexException error in Sample App java.lang.NoClassDefFoundError: com/google/appengine/api/datastore/AsyncDatastoreService - java.lang.NoClassDefFoundError: com/google/appengine/api/datastore/AsyncDatastoreService
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM