@webiny/api-headless-cms-ddb
Version:
DynamoDB storage operations plugin for Headless CMS API.
25 lines (23 loc) • 807 B
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createBatchScheduleFn = void 0;
var _constants = require("./constants");
/**
* 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
*/
const createBatchScheduleFn = () => {
if (_constants.CMS_ENTRY_BATCH_SCHEDULE_WAIT <= 0) {
return undefined;
}
return callback => {
setTimeout(callback, _constants.CMS_ENTRY_BATCH_SCHEDULE_WAIT);
};
};
exports.createBatchScheduleFn = createBatchScheduleFn;
//# sourceMappingURL=createBatchScheduleFn.js.map