Concurrent-Jobs (#7)

Fredy 2.0.0 introduces the concept of search jobs. You can now configure multiple of these jobs running in the same instance of Fredy. Also a new API has been created 🎉
This commit is contained in:
Christian Kellner
2020-02-26 09:05:20 +01:00
committed by GitHub
parent 52a32f7453
commit 770d30af95
50 changed files with 3297 additions and 1564 deletions

View File

@@ -1,5 +0,0 @@
module.exports = {
setLastScrape: () => {
/*noop*/
}
};

View File

@@ -1,27 +1,52 @@
const db = {};
exports.init = () => {
return new Promise(resolve => {
resolve();
});
};
exports.setKnownListings = (jobKey, providerId, listings) => {
if (!Array.isArray(listings)) throw Error('Not a valid array');
db[providerId] = listings;
};
exports.getKnownListings = (jobKey, providerId) => {
return db[providerId] || [];
};
exports.setNumberOfTotalFoundProviderListings = () => {
/*noop*/
};
exports.getForTesting = () => {
return db;
};
/*
class Store {
constructor(name) {
this._name = name;
this._db = {};
}
constructor(name) {
this._name = name;
this._db = {};
}
get warmup() {
this._db = {};
return new Promise(resolve => resolve());
}
get warmup() {
this._db = {};
return new Promise(resolve => resolve());
}
set knownListings(value) {
if (!Array.isArray(value)) throw Error('Not a valid array');
return new Promise(resolve => {
this._db[this._name] = value;
resolve(value);
});
}
set knownListings(value) {
if (!Array.isArray(value)) throw Error('Not a valid array');
return new Promise(resolve => {
this._db[this._name] = value;
resolve(value);
});
}
get bla() {}
get knownListings() {
return this._db[this._name] || [];
}
get knownListings() {
return this._db[this._name] || [];
}
}
module.exports = Store;
*/