fabe / gatsby-plugin-drive

🚗 Downloads a Google Drive folder that you can query with gatsby-source-filesystem.
https://npm.im/@fs/gatsby-plugin-drive
MIT License
12 stars 15 forks source link

Deleting files/rate limiting #8

Closed martynhoyer closed 4 years ago

martynhoyer commented 5 years ago

More of a question really, but I've just installed the plugin and am using it quite successfully, but then got stung by the rate limiting.

My use case is I'm using Google Drive to store images for a couple of areas of the site. I have two folders, one with (currently) six images in it, the other has around 30 images.

I was hoping that I'd be able to effectively "sync" the folders to my Gatsby site, so that when a file is deleted, a Gatsby rebuild would also remove that file. Obviously that's much more tricky from the plugin point of view, so I figured I could just clean those directories before a build (as the docs suggested) and do a fresh pull of the Google Drive folder every time.

It feels like the rate limiting is going to get in the way of that though, but I'm not sure how it's doing the calculations. Given that I should be allowed 1000 requests every 100 seconds, it surprised me that I got blocked after downloading less than 40 images. The developer console isn't much help either!

Just wondering if you know any more about how the requests are used?

fabe commented 5 years ago

This is related to #5, could be that there's too many requests per second. I think I'll add a delay option to the plugin that should fix this.

martynhoyer commented 5 years ago

Thanks! Apologies, I didn't see that issue.

Yeah a delay sounds like it might get around it. I'll try the quick fix suggested in #5 in the mean time!