mirror of
https://github.com/orangecoding/fredy.git
synced 2026-06-16 12:31:07 +00:00
sending job key with the listings
This commit is contained in:
@@ -3,7 +3,7 @@ const {
|
||||
setKnownListings,
|
||||
getKnownListings,
|
||||
setNumberOfTotalFoundProviderListings,
|
||||
getForTesting
|
||||
getForTesting,
|
||||
} = require('./services/store');
|
||||
|
||||
const notify = require('./notification/notify');
|
||||
@@ -79,7 +79,7 @@ class FredyRuntime {
|
||||
}
|
||||
|
||||
_findNew(listings) {
|
||||
const newListings = listings.filter(o => getKnownListings(this._jobKey, this._providerId).indexOf(o.id) === -1);
|
||||
const newListings = listings.filter((o) => getKnownListings(this._jobKey, this._providerId).indexOf(o.id) === -1);
|
||||
|
||||
if (newListings.length === 0) {
|
||||
throw new NoNewListingsError();
|
||||
@@ -89,14 +89,14 @@ class FredyRuntime {
|
||||
}
|
||||
|
||||
_notify(newListings) {
|
||||
const sendNotifications = notify.send(this._providerId, newListings, this._notificationConfig);
|
||||
const sendNotifications = notify.send(this._providerId, newListings, this._notificationConfig, this._jobKey);
|
||||
return Promise.all(sendNotifications).then(() => newListings);
|
||||
}
|
||||
|
||||
_save(newListings) {
|
||||
setKnownListings(this._jobKey, this._providerId, [
|
||||
...getKnownListings(this._jobKey, this._providerId),
|
||||
...newListings.map(l => l.id)
|
||||
...newListings.map((l) => l.id),
|
||||
]);
|
||||
return newListings;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user