DeadlineExceededException while checking android suscriptions

2 views
Skip to first unread message

Rubén Avendaño Caballero via StackOverflow

unread,
Oct 8, 2016, 10:10:07 AM10/8/16
to google-appengin...@googlegroups.com

I'm developing an app with Google App Engine, Datastore and In App Subscription. Every night I check all entities (thousends) and check for every one if subscription has been ended using a cron. I always get this exceptions:

com.google.apphosting.api.ApiProxy$CancelledException: The API call urlfetch.Fetch() was cancelled because the overall HTTP request deadline was reached.Token_socialauth= bjldfo.................

com.google.apphosting.api.DeadlineExceededException: This request (869234629215790c) started at 2016/10/07 00:00:01.429 UTC and was still executing at 2016/10/07 00:10:01.333 UTC.Token_socialauth= bj............

Error for /cron_actualiza_perfiles com.google.apphosting.runtime.HardDeadlineExceededError: This request (869234629215790c) started at 2016/10/07 00:00:01.429 UTC and was still executing at 2016/10/07 00:10:01.906 UTC.
at sun.misc.Unsafe.park(Native Method)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:389)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:90)
at com.google.appengine.tools.development.TimedFuture.get(TimedFuture.java:57)..............


Uncaught exception from servlet com.google.apphosting.runtime.HardDeadlineExceededError: This request (869234629215790c) started at 2016/10/07 00:00:01.429 UTC and was still executing at 2016/10/07 00:10:01.906 UTC.
at sun.misc.Unsafe.park(Native Method)
at java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:226)
at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:389)
at com.google.common.util.concurrent.AbstractFuture$TrustedFuture.get(AbstractFuture.java:90)
at com.google.appengine.tools.development.TimedFuture.get(TimedFuture.java:57)
at com.google.common.util.concurrent.ForwardingFuture.get(ForwardingFuture.java:69)................

The code is more or less like this:

datastore = DatastoreServiceFactory.getDatastoreService();
FetchOptions queryOptions = Builder.withChunkSize(200);

do {

    if (cursor != null) {
        queryOptions.startCursor(cursor);
    }
    results = this.datastore.prepare(q).asQueryResultList(queryOptions);
    for (Entity entidad_perfiles : results) {
        if (cancelled()){
            update_entity();
        }
    }
}while (results.size() == 200);

boolean cancelled(){
    boolean resultado= false;
    JSONObject respuesta= null;
    StringBuilder result=new StringBuilder();
    URL url = new URL("https://www.googleapis.com/androidpublisher/v2/applications/com.rubisoft.xradar/purchases/subscriptions/suscribir_6_meses_premium_x_5_euros/tokens/" + token_suscripcion_premium+"?access_token="+ access_token);
    HttpURLConnection conn = (HttpURLConnection) url.openConnection();
        conn.setRequestMethod("GET");
        BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream()));
    String line;
    while ((line = rd.readLine()) != null) {
        result.append(line);
    }
    rd.close();
    respuesta = new JSONObject(result.toString());
}

As you can see I use cursor, but do not resolve my problem.

Can anybody help me?



Please DO NOT REPLY directly to this email but go to StackOverflow:
http://stackoverflow.com/questions/39933368/deadlineexceededexception-while-checking-android-suscriptions
Reply all
Reply to author
Forward
0 new messages