Google Drive REST-API Internal error 500

痴心易碎 提交于 2019-12-13 04:33:48

问题


I'm developing an application that receives several massage queue containing 20-30 gmail addresses. My app owns a single google drive folder that must be shared with all of the users. My app uses Google drive Java client and for the HTTP calls I'm using Google batching

The problem is that I'm getting internal error 500 when I'm trying to share the folder with 30 users simultaneously by multithreading. However when I use threads synchronisation everything is fine but the performance is terrible about 0.5 second per user!

Can anyone explain Why I'm receiving this error?

500 OK
        {
        "code" : 500,
        "errors" : [ {
        "domain" : "global",
        "message" : "Internal Error. User message: \"An internal                                                     error has occurred which prevented the sharing of these item(s): fileame\"",
       "reason" : "internalError"
        } ],
      "message" : "Internal Error. User message: \"An internal error has occurred which prevented the sharing of these item(s): filename\""
        }

Here is the thread code:

try {
        //batch start
        BatchRequest batch = service.batch();
        ArrayList<String> users = readUsers(this.file);
        Permission[] permissions= new Permission[users.size()];
        for (int i = 0 ; i < users.size(); i++){
           permissions[i]= new Permission();
           permissions[i].setValue(users.get(i)+"@gmail.com");
           permissions[i].setType("user");
           permissions[i].setRole("writer");
           service.permissions().insert(fileId, permissions[i]).setSendNotificationEmails(Boolean.FALSE)                    .queue(batch, callback);                  
        }
        //batch execute
       batch.execute();
    } catch (IOException e) {
        System.out.println("An error occurred and I am " + id + ": " + e);
    }

来源:https://stackoverflow.com/questions/37967707/google-drive-rest-api-internal-error-500

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!