mongodb-simplecrawler-queue
Version:
MongoDB FetchQueue Implementation for Simplecrawler
27 lines • 856 B
JavaScript
;
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