-
-
Notifications
You must be signed in to change notification settings - Fork 60
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error while creating folder after deleting it from gdrive #29
Comments
This package is using a little cache trick, if you delete a folder in Google drive manually, that folder still remains in cache even though it no longer exists in google drive (if you are using a long running script, because on every new instance it starts the connection and cache), maybe the function flysystem-google-drive-ext/src/GoogleDriveAdapter.php Lines 257 to 263 in aa0b678
@masbug is this a bug?, maybe i can make a fix |
Storage::disk('google')->getDriver()->getAdapter()->clearCache(); |
On limitation's section
So, for concurrent threads of queued jobs you have to do this workaround with cache, otherwise you get those errors, or when create a directory duplicate(created at the same time with same name) and you put a unique file or folder inside, the adapter will be able to reach it properly because it chooses the oldest (first), so, create directory, uncache the folder, then put file inside $disk=\Storage::disk('google');
$disk->createDir('test/testa');
//manually delete without adapter or other job create it first
$dir=$disk->getDriver()->getAdapter()->getMetadata('test/testa');
$disk->getDriver()->getAdapter()->getService()->files->delete($dir['id']);
//uncache
$disk->getDriver()->getAdapter()->uncacheFolder('test/testa');
// refresh id and put file
$disk->put('test/testa/file.txt', 'Contents1'); |
@gcilinskas |
Yeah, manual human interaction with gdrive is possible on our side so removal of folders might be at random times. We are fetching data from api and saving its assets to gdrive in structured folders hierarchy. clearCache method helped for now, performance for gdrive upload is not crucial for us. Regarding to racing conditions we did some workarounds with sleep functions, currently seems to work We don't have options to change approaches in usage of gdrive folders |
Ok. So I guess you're doing something similar to:
|
Steps to replicate:
Locally works, but throws this error on live servers (AWS EC2 Instance Ubuntu)
The text was updated successfully, but these errors were encountered: