Skip to content

Commit 1286262

Browse files
committed
Output feed trimming policy when starting server
1 parent 3509cbb commit 1286262

File tree

3 files changed

+18
-8
lines changed

3 files changed

+18
-8
lines changed

README.md

+10-5
Original file line numberDiff line numberDiff line change
@@ -130,11 +130,16 @@ does not exist it will be created. When the server starts the path on the
130130
server for the feed is printed. This is what you would use to subscribe to the
131131
feed in your feed reader.
132132

133-
**Note:** The feed is capped to 50 items, with older items dropped when a new
134-
item is added. The limit was added to stop the feed growing forever since there
135-
is no way for Feedlynx to know when an item has been read. RSS readers need to
136-
download and process the whole feed whenever there are new items, so imposing a
137-
cap helps limit the size and scope of that work.
133+
**Feed Trimming**
134+
135+
When a new link is added links older than 30 days are considered for removal.
136+
Feedlynx will retain up to 50 entries. Entries older than 30 days in excess of
137+
50 entries will be removed, oldest first.
138+
139+
The limit was added to stop the feed growing forever since there is no way for
140+
Feedlynx to know when an item has been read. RSS readers need to download and
141+
process the whole feed whenever there are new items, so imposing a cap helps
142+
limit the size and scope of that work.
138143

139144
### Example
140145

src/feed.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ use uriparse::URI;
1111
use crate::webpage::WebPage;
1212
use crate::{base62, Error};
1313

14-
const MIN_ENTRIES: usize = 50;
15-
const TRIM_AGE: TimeDelta = TimeDelta::days(30);
14+
pub const MIN_ENTRIES: usize = 50;
15+
pub const TRIM_AGE: TimeDelta = TimeDelta::days(30);
1616

1717
pub struct Feed {
1818
path: PathBuf,

src/server.rs

+6-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ use tiny_http::{Header, HeaderField, Method, Request, Response, StatusCode};
1515
use tinyjson::JsonValue;
1616
use uriparse::URI;
1717

18-
use crate::feed::Feed;
18+
use crate::feed::{self, Feed};
1919
use crate::webpage::WebPage;
2020
use crate::{embed, webpage, FeedToken, PrivateToken};
2121

@@ -85,6 +85,11 @@ impl Server {
8585
let _ = HTML_CONTENT_TYPE.set("Content-type: text/html; charset=utf-8".parse().unwrap());
8686
let _ = JSON_CONTENT_TYPE.set("Content-type: application/json".parse().unwrap());
8787

88+
info!(
89+
"Feed trimming policy: Min entries: {}, trim age: {} days",
90+
feed::MIN_ENTRIES,
91+
feed::TRIM_AGE.num_days()
92+
);
8893
info!(
8994
"Feed available at: http://{}{}",
9095
self.server.server_addr(),

0 commit comments

Comments
 (0)