David Osipyan
David Osipyan

Reputation: 11

Batch permission insert is not working properly in Google Drive API v. 1.8.1

I added more than two requests to the batch and executed it. Not all permissions are set on the Google Drive items. Usually two random permissions are set.

Let' assume we have a DriveService object (gdService), an ID of some Google Drive item (destThirdPartyId) and collection of Permpermission type objects (permissionList).

Here is the code demonstrating the issue:

BatchRequest batchRequest = new BatchRequest(service_);

foreach (Permission perm in permissionList)
{ 
 PermissionsResource.InsertRequest request = service_.Permissions.Insert(perm, destThirdPartyId);
 batchRequest.Queue<InsertPermissionResponse>(request, null);
}

batchRequest.ExecuteAsync().Wait();

After that only few requests are performed on Google Drive side. But executing same requests separately works fine:

foreach (Permission perm in permissionList)
{ 
 PermissionsResource.InsertRequest request = service_.Permissions.Insert(perm, destThirdPartyId);
 request.Execute();
}

Upvotes: 1

Views: 387

Answers (1)

Cheryl Simon
Cheryl Simon

Reputation: 46844

This is a known issue. As it says on the permissions update doc, currently concurrent modifications of permissions are not supported. You need to wait for the first to return before sending any more.

Upvotes: 1

Related Questions