From 0b753d234caff870e7a5fcb5b4bc4fac1a2e1acf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Schimmelpfennig?= Date: Wed, 24 Apr 2024 12:44:14 +0200 Subject: [PATCH] fix: updating newTimestampId correctly last PR from me introduce an error with the setting newTimestampId, so that's impossible to get new posts :/ --- main.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/main.js b/main.js index fa5f6f2..329979a 100644 --- a/main.js +++ b/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) }