@webiny/api-headless-cms-ddb-es
Version:
DynamoDB and Elasticsearch storage operations plugin for Headless CMS API.
19 lines (17 loc) • 641 B
JavaScript
import { CMS_ENTRY_BATCH_SCHEDULE_WAIT } from "./constants.js";
/**
* This is to be used when user wants to wait for a number of milliseconds before the batch is executed.
* Intended to be used internally or for a specific user case.
* Not to be documented and exposed to publish as it can slow the data loading a lot.
*
* https://github.com/graphql/dataloader#batch-scheduling
*/
export const createBatchScheduleFn = () => {
if (CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) {
return undefined;
}
return callback => {
setTimeout(callback, CMS_ENTRY_BATCH_SCHEDULE_WAIT);
};
};
//# sourceMappingURL=createBatchScheduleFn.js.map