export default function handleEvents()

in src/index.js [41:53]


export default function handleEvents ({cmsfronts, frontend, lambda, jsonConfig, logger = console}) {
	return Config(cmsfronts).fetch().then(config => {
		const checkThese = [
			...pickRandom(2)(config.listFrontsIds('editorial')).map(front => staleIfBefore(front, EDITORIAL_STALE)),
			...pickRandom(2)(config.listFrontsIds('commercial')).map(front => staleIfBefore(front, COMMERCIAL_STALE))
		];
		logger.log('Checking at', new Date(), checkThese);

		return Press(frontend)
		.batchGetLastModified(...checkThese.map(item => [item.front, 'live']))
		.then(frontsMap => alertOnStale(checkThese, frontsMap, lambda, logger, jsonConfig));
	});
}