Content doesn't need to be calculated twice.

This commit is contained in:
Half-Shot 2024-02-07 15:11:32 +00:00
parent bd0822ee95
commit db23748dba
2 changed files with 9 additions and 10 deletions

View File

@ -220,15 +220,16 @@ export class FeedConnection extends BaseConnection implements IConnection {
// We want to retry these sends, because sometimes the network / HS
// craps out.
const content = {
msgtype: 'm.notice',
format: "org.matrix.custom.html",
formatted_body: md.renderInline(message),
body: message,
external_url: entry.link ?? undefined,
"uk.half-shot.matrix-hookshot.feeds.item": entry,
};
await retry(
() => this.intent.sendEvent(this.roomId, {
msgtype: 'm.notice',
format: "org.matrix.custom.html",
formatted_body: md.renderInline(message),
body: message,
external_url: entry.link ?? undefined,
"uk.half-shot.matrix-hookshot.feeds.item": entry,
}),
() => this.intent.sendEvent(this.roomId, content),
SEND_EVENT_MAX_ATTEMPTS,
SEND_EVENT_INTERVAL_MS,
// Filter for showstopper errors like 4XX errors, but otherwise

View File

@ -150,8 +150,6 @@ export class FeedReader {
}
observedFeedUrls.forEach(url => this.feedQueue.push(url));
this.feedQueue.shuffle();
Metrics.feedsCount.set(observedFeedUrls.size);
Metrics.feedsCountDeprecated.set(observedFeedUrls.size);
return observedFeedUrls;