Closed GioChocolateBro closed 6 months ago
Interesting. Can you share a dd of $this->directories()
inserted somewhere around line 69 of that file? You seem to be getting a nested directory list, which shouldn't be the case and I just want to confirm.
I've opened a PR here with the changes I think are required. Can you test it and let me know if it works for you?
Hi @ryanmitchell ,
Thanks for the quick response. It does continue now but gets stuck into a recursive loop. It's been processing - re-processing the same folder for quite some time now.
It processed a couple of folder and then got stuck on a double nested folder. root > events > event-name > file.png
it keeps processing folder event, then event-1, event, event-1 and so on.
Also I still don't see any new entries in my assets_meta table. It's supposed to enter any processed items into the table right? This is what will give the performance gains in terms of not having to talk to digitalocean?
Does this change help? https://github.com/ryanmitchell/eloquent-driver/commit/b7dc24eadc7a9cf3c1abdfee9f6b6bad54a5475f
Laravel can try to be clever with database inserts and batch them, so it's possible youre not seeing updates due to that. Also do make sure you've got assets set to eloquent
in the eloquent-driver config.
Initially it throws an exception because $folder isn't accessible for the if statement on line 89
->each(function ($subfolder) use ($container, $folder) {
When I added it, it got stuck on the first folder (not the double nested folder) in the same manner as before.
@GioChocolateBro I've pushed an update which should fix that.
Hi @ryanmitchell ,
Yes this seems to work, thanks a bunch 🌟 ! It's been running for some time now. It will be a while before it finishes syncing.
But it has definitely synced over 3K assets already and there has been no batch insert yet. I checked my config again and it is set to eloquent
'asset_containers' => [
'driver' => 'file',
'model' => \Statamic\Eloquent\Assets\AssetContainerModel::class,
],
'assets' => [
'driver' => 'eloquent',
'model' => \Statamic\Eloquent\Assets\AssetModel::class,
'asset' => \Statamic\Eloquent\Assets\Asset::class,
],
Should I still be holding out for a batch insert or is there something else going on?
Im not sure on that, its inserting fine on my side so you'd need to debug it a bit yourself to see why its not inserting.
After exiting the sync and starting it again it will fall into recursion again on the first folder it encounters. This time indefinitely creating deeper levels of meta folders.
@ryanmitchell , I've been digging around but I don't see where inside the SyncAsset writeMeta()
should be getting called?
Inside the ImportAsset command it's very clearly creating the database records, but inside SyncAsset I can't find any reference to it.
it happens inside the asset class. I dont have any further time to work on this today (sorry).
No worries, your work is greatly appreciated.
I added some code to prevent .meta folders being processed - maybe that helps your error as well.
@GioChocolateBro can you pull down the latest version of the PR and see if the changes resolve the issues you have experienced?
Hi @ryanmitchell ,
Sorry, I had a busy week and lost track of this PR. I will be checking it out next week and try to upgrade my app to 3.x again. Thanks so much for your quick assistance and all your work on the eloquent driver 🙏 ❤️ .
I just installed the 3.0 update. I have a sizeable filesystem with lots of folders in digitalocean spaces.
After installation the
eloquent:sync-assets
command throws an exception when it reaches the end of processing the root folder and trying to move on to nested folders.When I try to access the container through the CP it's empty. I also don't see any of the processed assets in my database. Just the ones that were already there (the only assets that had meta data)