gimite / google-spreadsheet-ruby

Ruby library to read/write Google Spreadsheet
Other
306 stars 52 forks source link

Time out errors when assigning permissions to google drive folders #46

Closed Nawshine closed 11 years ago

Nawshine commented 11 years ago

Hi

I am using the gem to create folders and sub folders and assigning access to them. Looks simple enough - however I cannot get the app to work without getting a 'Time Error' or 'Response code 409 - user already has access to the folder'

Here is my requirement; I have 2 levels of folder

Main Folder [Read Access to group 1, group2 and group3] -- Sub Folder 1 [Write Access to group 1 and group 2, no access to group 3] -- Sub Folder 2 [Write Access to group 1 and group 3, no access to group 2]

The problem is each time is give read access to the 'Main Folder' the permission is cascaded down to sub folders 1 and 2. So each time I need to revoke the 'Read' access of each group on the Sub Folders to assign 'Write access'. It works fine until I make more than 3 consecutive requests. I get 'Time out Errors' or 'Response code 409 - user already has access to this folder' when trying to delete the Read access or assigning 'Write access'(I'm ensuring that I delete the 'Read Access' before assigning 'Write Access'.)

I wanted to know whether there is a time frame limitation on the calls I'm making or is there a better way of doing it. My code can be found at http://paste.org/61663 (Apologies for the length of it - I'm sure there a better and faster way of doing it - your comments and advice are humbly accepted)

Thanks Nawshine

gimite commented 11 years ago

I also sometimes see the unit test of google_drive fails due to server error. So it may have some rate limit. How about automatically retrying after some pause in case of such errors?

Nawshine commented 11 years ago

Thank you for the reply Hiroshi. That's what I am doing actually.