Multiple Rendition Plugin Error


#1

Multiple Rendition Error()

I’m trying to make rendition of single image file.

Note: I have only used single rendition using application API

When plugin invoked console says:

Plugin Error: Multiple createRenditions() calls cannot run concurrently. Wait for the previous call's Promise to resolve before calling again.

Expected Behavior

The plugin on invoke it should render the selected image file.

Actual Behavior

Plugin error : Multiple createRenditions() can’t run concurrently.

Additional information


#2

Can you share a sample plugin that demonstrates the issue so we can test?


#3

To clarify: Do you report creating multiple renditions doesn’t work or that creating multiple renditions concurrently doesn’t work (which – as per the documentation – is to be expected)?

If you merely wish to create multiple renditions, you’ll have to await the Promise returned by createRenditions() (as the console output says) and produce them one after the other.

If, on the other hand, you’re asking to be able to concurrently create renditions: Why do you need to do it simultaneously? (I currently can’t think of any use-case that requires that)… Then, this would be a feature request and not a bug report, though, since it is to be expected (and not a bug) that createRenditions() cannot be called concurrently…

Thank you very much in advance,
Best,
Pablo


#4

If you are trying to export multiple renditions, here is a code example:

const application = require("application");
const fs = require("uxp").storage.localFileSystem;


async function exportRendition(selection) {
	const folder = await fs.getFolder();
    const arr = await selection.items[0].children.map(async item => {		
		const file = await folder.createFile(`${item.guid}.png`);
		let obj = {};
		obj.node = item;
		obj.outputFile = file;
		obj.type = "png";
		obj.scale = 2;
		return obj
    })
    const renditions = await Promise.all(arr);
    await application.createRenditions(renditions)
}

module.exports = {
    commands: {
        exportRendition
    }
};

#5

Thank you!:smiley::smile: