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:
René Schimmelpfennig 2024-04-24 12:44:14 +02:00 committed by GitHub
parent 887ba8fcc7
commit 0b753d234c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)
}