diff --git a/.changeset/wild-rabbits-run.md b/.changeset/wild-rabbits-run.md new file mode 100644 index 0000000..387a7ca --- /dev/null +++ b/.changeset/wild-rabbits-run.md @@ -0,0 +1,5 @@ +--- +"@bicou/directus-extension-imagga": patch +--- + +wait between api calls diff --git a/src/index.ts b/src/index.ts index 5ae1262..519e23d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -184,6 +184,10 @@ export default defineHook(({ action }, { services, logger }) => { // retrieve colors let colors: object | undefined; if (IMAGGA_COLORS_ENABLE) { + // wait 1 second to avoid rate limiting + if (IMAGGA_TAGS_ENABLE) await new Promise((resolve) => setTimeout(resolve, 1000)); + + // imagga api call const response = await axios.get(IMAGGA_API + "/colors", { params: { image_upload_id: upload_id,