UNPKG

mongodb-simplecrawler-queue

Version:
27 lines 856 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const utils_1 = require("./utils"); class GarbageCollector { constructor(collection, msInterval = 1000 * 60 * 2) { this.collection = collection; this.msInterval = msInterval; } start() { this.timeoutId = setTimeout(() => { utils_1.Operations.gcTask(this.collection, this.msInterval) .then(() => { setTimeout(() => { this.start(); }, this.msInterval); }) .catch((error) => { console.log(error); }); }, this.msInterval); } stop() { clearTimeout(this.timeoutId); } } exports.GarbageCollector = GarbageCollector; //# sourceMappingURL=GarbageCollector.js.map