UNPKG

dce-mango

Version:

Harvard DCE's Non-relational DB Wrapper.

27 lines 995 B
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); // Import constants const DEFAULT_LOCK_TTL_MS_1 = __importDefault(require("../constants/DEFAULT_LOCK_TTL_MS")); /** * Helper for initializing the lock collection. * For unifying construction of lock-collections (for testing). * @author Benedikt Arnarsson * @param ttlMS the time to live (in ms) of the locks in the collection. * @returns the options used to construct a collections corresponding lock-collection. */ const getLockCollectionOpts = (ttlMS) => { return { expireAfterSeconds: (ttlMS ? ttlMS / 1000 : DEFAULT_LOCK_TTL_MS_1.default / 1000), uniqueIndexKey: 'id', indexKeys: [ 'serverId', ], }; }; exports.default = getLockCollectionOpts; //# sourceMappingURL=getLockCollectionOpts.js.map