Fixed "didn't post" message being logged every single check
This commit is contained in:
parent
5d0dfc97e2
commit
4c76852c65
11
feed-bot.js
11
feed-bot.js
|
@ -155,7 +155,7 @@ var Links = {
|
||||||
if (err) Log.error("FEED ERROR: Error reading RSS feed.", err);
|
if (err) Log.error("FEED ERROR: Error reading RSS feed.", err);
|
||||||
else {
|
else {
|
||||||
var latestLink = Links.standardise(articles[0].link);
|
var latestLink = Links.standardise(articles[0].link);
|
||||||
if (Config.youtubeMode) latestLink = YouTube.createShareUrl(latestLink);
|
if (Config.youtubeMode) latestLink = YouTube.url.createShareUrl(latestLink);
|
||||||
|
|
||||||
//make sure we don't spam the latest link
|
//make sure we don't spam the latest link
|
||||||
if (latestLink == Links.latestFeedLink)
|
if (latestLink == Links.latestFeedLink)
|
||||||
|
@ -164,12 +164,13 @@ var Links = {
|
||||||
//make sure the latest link hasn't been posted already
|
//make sure the latest link hasn't been posted already
|
||||||
if (Links.isCached(latestLink)) {
|
if (Links.isCached(latestLink)) {
|
||||||
Log.info("Didn't post new feed link because already detected as posted " + latestLink);
|
Log.info("Didn't post new feed link because already detected as posted " + latestLink);
|
||||||
return;
|
}
|
||||||
|
else {
|
||||||
|
callback(latestLink);
|
||||||
|
|
||||||
|
Links.cache(latestLink); //make sure the link is cached, so it doesn't get posted again
|
||||||
}
|
}
|
||||||
|
|
||||||
callback(latestLink);
|
|
||||||
|
|
||||||
Links.cache(latestLink); //make sure the link is cached, so it doesn't get posted again
|
|
||||||
Links.latestFeedLink = latestLink; //ensure our latest feed link variable is up to date, so we can track when the feed updates
|
Links.latestFeedLink = latestLink; //ensure our latest feed link variable is up to date, so we can track when the feed updates
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue