stravo1 / obsidian-gdrive-sync

sync notes across devices in Obsidian via Google Drive
114 stars 0 forks source link

Initialization of vault is creating duplicate files in GDrive #2

Closed ashishbhateja closed 4 months ago

ashishbhateja commented 4 months ago

Just started with the plugin. I am seeing several duplicate files being created on GDrive.

CleanShot 2024-01-07 at 22 04 50@2x

stravo1 commented 4 months ago

might happen that due to network issues the "cleanInstall" function was executed twice or somehow the button to initialise the vault was clicked more than once or the app was quit before the upload was complete and thus it started again.

i would suggest you delete the vault folder from the obsidian directory in your Drive (even from Bin) and start with the initialisation process again, maintain a good internet connection and wait until it shows that "Files uploaded" and tells you to reload the plugin.

(it might take a while to upload all files depending on the number of files and their sizes, please be patient)

ashishbhateja commented 4 months ago

Thanks. Restarted initialisation. What are the steps to sync on a second device (say iOS) after files are uploaded? My vault is currently synced using Obsidian sync. Shall I switch off Obsidian sync there and then load the plugin?

stravo1 commented 4 months ago

i have not used obsidian sync, so can't help much there. maybe turning off obsidian sync and enabling the plugin will work fine. however if possible i would suggest not mixing them together as obsidian sync might not like what this plug-in does(if you switch back to obsidian sync). i would suggest copying the files to a new vault and installing the plug-in on that before making a switch. for iOS devices the easiest option to install plugins (via the .obisidan/plugins path) is to create the project on the desktop, install the plugin and then copying the entire vault folder to the iOS device.

and once initialization is complete, installing the plugin on any other device (on the same vault) and signing in will enable sync, no other steps required.

stravo1 commented 4 months ago

also please let me know if the duplicate files issue is still there, else will close this issue

ashishbhateja commented 4 months ago

Sure, give me a few hours and I will report back.

ashishbhateja commented 4 months ago

It took about 2 hours for the initialization to complete. My internet connection is fast. For comparison, Obsidian sync takes around 10–12 minutes.

I saw a gray screen when I checked upon completion: CleanShot 2024-01-08 at 06 33 33@2x

I exited Obsidian and then restarted the program. There seem to be no duplicate files in Google Drive.

Is there a way to confirm if all the files have been uploaded? There was no message in Obsidian perhaps because the app froze.

The vault is now stuck at indexing: CleanShot 2024-01-08 at 06 36 14@2x

Here are my settings: CleanShot 2024-01-08 at 06 35 37@2x

Edit: Switching off the plugin and restarting it seems to have fixed the vault issue.

stravo1 commented 4 months ago

the plug-in doesn't support parallel uploads (or downloads) so for huge vaults it might take a while (but it shouldn't freeze the app).

and Obsidian indexes your vault for better searching, fetching and querying your notes, i don't think that's related to the plug-in.

if logging was enabled we could have checked the log files to see whether the upload was complete or not.

even if all the files were not uploaded, when you modify any file which was not uploaded initially they will be uploaded automatically.

however i would suggest not to use this plug-in for huge vaults like yours, this plug-in is not really "efficient" for vaults of that size, or if you do use the plug-in please increase the refresh time as much as you can (say 30secs or more) because the refresh functionality works by fetching the list of files in drive and then comparing them to the list of local files.

till now i have been assuming you have a vault with significant size based on how long it took to upload all the files, but can you confirm the number of files in your vault? if it's something manageable by the plug-in i need to look into this issue.

ashishbhateja commented 4 months ago

Thanks for the feedback. I have approximately 2700 files in my vault. I do have several attachments and the vault is around 3 GB in size.

stravo1 commented 4 months ago

thanks for confirming :) yeah the plug-in is not made for such big numbers, will try and modify the plug-in so that it manages the vault in chunks.

thanks for the feedback, closing the issue for now, keep an eye on the releases :)

ashishbhateja commented 4 months ago

I wonder if there is a way to sync various attachments via GDrive and notes via Obsidian sync. Do you think such an option can be added?

stravo1 commented 4 months ago

i didn't understand your question. that's exactly what this plug-in does 😅 (but can't handle so many files right now)

ashishbhateja commented 4 months ago

that's exactly what this plug-in does 😅 (but can't handle so many files right now)

Option to sync other than .md files to Google drive. Let Obsidian sync manage the .md files. I can omit syncing attachments (other than md files) in Obsidian sync.

stravo1 commented 4 months ago

ahh got it (i was dumb)

it's something i can look into later

ashishbhateja commented 4 months ago

Thanks! I think that syncing files other than .md might be simpler, given they typically don't undergo changes within Obsidian. This could reduce the likelihood of sync conflicts. Additionally, excluding large files from the regular sync process for .md files could potentially enhance its efficiency.

stravo1 commented 2 months ago

hello! added rudimentary support for vaults having >1000 files, you can test the plugin once more and see if anything changed from your previous experience

https://github.com/stravo1/obsidian-gdrive-sync/releases/tag/v0.9.9-beta-7