fix: updating newTimestampId correctly
last PR from me introduce an error with the setting newTimestampId, so that's impossible to get new posts :/
This commit is contained in:
parent
887ba8fcc7
commit
0b753d234c
1 changed files with 4 additions and 4 deletions
8
main.js
8
main.js
|
@ -83,15 +83,15 @@ async function fetchNewPosts() {
|
|||
reversed.forEach((item) => {
|
||||
const currentTimestampId = Date.parse(item.published);
|
||||
|
||||
if (currentTimestampId > newTimestampId) {
|
||||
newTimestampId = currentTimestampId;
|
||||
}
|
||||
|
||||
if (currentTimestampId > lastProcessedPostId && lastProcessedPostId != 0) {
|
||||
try {
|
||||
console.log('📧 posting to BlueSky', currentTimestampId)
|
||||
const text = truncate(removeHtmlTags(item.object.content), currentTimestampId);
|
||||
postToBluesky(text);
|
||||
|
||||
if (currentTimestampId > newTimestampId) {
|
||||
newTimestampId = currentTimestampId;
|
||||
}
|
||||
} catch (error) {
|
||||
console.error('🔥 can\'t post to Bluesky', currentTimestampId, error)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue