Skip to content
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

V11 migration - ensure macro never called twice quickly #208

Open
farling42 opened this issue May 29, 2023 · 2 comments
Open

V11 migration - ensure macro never called twice quickly #208

farling42 opened this issue May 29, 2023 · 2 comments

Comments

@farling42
Copy link

Thanks for all the hard work you've done in the past for CF.

For the migration, is it possible to provide a lock so that the migration function can't be called again before a previous call has finished?

Since CF has always cached the currently open folder, this can cause problems if trying to migrate two compendiums at the same time (since the most recently started compendium will be in the cache, and cause the other compendium to be wrongly set up).

@earlSt1
Copy link
Owner

earlSt1 commented May 30, 2023

Hi, sure I can add a flag that is set when the module runs a migration. I initially intended for you to only be able to run one migration at a time, but i can see how running multiple migrations would break things

@farling42
Copy link
Author

I have a lot of compendiums in shared modules, so I'm using the following script, but others might not be so careful:

for (const pack of game.packs.values()) {
     const packid = pack.metadata.id
     const locked = pack.locked;
     console.log(`Migrating ${packid}`)
     if (locked) pack.configure({locked:false});
     await game.CF.FICFolderAPI.migrateCompendium(packid);
     if (locked) pack.configure({locked:true});
     console.log(`Finished ${packid}`);
}
console.log('** FINISHED CF MIGRATION **')

My first attempt at a script was using forEach, but that didn't seem to serialize the calls to migrateCompendium properly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants