Remove dead defaultPollIntervalMinutes global setting
Confirmed dead: every source's pollIntervalMinutes is NOT NULL DEFAULT 15 and the admin form only ever submits 5/15/60, so sourcesDueForPoll()'s fallback to the global default could never actually trigger. Removes the setting end to end (schema, settings.ts, scheduler/poller/sources signatures, admin types, mock backend fixture) and drops the now-single-item "Poll interval" panel from the Sources & Merge tab.
This commit is contained in:
@@ -22,8 +22,8 @@ const adapters: Record<Source['type'], SourceAdapter> = {
|
||||
// as opposed to Telegram where the message itself *is* the content.
|
||||
const FOLLOWS_LINK_FOR_FULL_ARTICLE: Source['type'][] = ['rss', 'api'];
|
||||
|
||||
export async function pollDueSources(defaultIntervalMinutes: number): Promise<number> {
|
||||
const due = sourcesDb.sourcesDueForPoll(defaultIntervalMinutes);
|
||||
export async function pollDueSources(): Promise<number> {
|
||||
const due = sourcesDb.sourcesDueForPoll();
|
||||
let ingested = 0;
|
||||
for (const source of due) {
|
||||
ingested += await pollOne(source);
|
||||
|
||||
@@ -24,8 +24,7 @@ export function startScheduler() {
|
||||
|
||||
setInterval(async () => {
|
||||
try {
|
||||
const settings = settingsDb.getSettings();
|
||||
const ingested = await pollDueSources(settings.defaultPollIntervalMinutes);
|
||||
const ingested = await pollDueSources();
|
||||
if (ingested > 0) logger.info('scheduler', `Poll tick: ingested ${ingested} new item(s)`);
|
||||
} catch (err) {
|
||||
logger.error('scheduler', `Poll tick failed: ${(err as Error).message}`);
|
||||
|
||||
@@ -168,7 +168,6 @@ export function migrate() {
|
||||
CREATE TABLE IF NOT EXISTS global_settings (
|
||||
id INTEGER PRIMARY KEY CHECK (id = 1), -- singleton row
|
||||
merge_strictness INTEGER NOT NULL DEFAULT 3,
|
||||
default_poll_interval_minutes INTEGER NOT NULL DEFAULT 15,
|
||||
hold_before_publish_minutes INTEGER NOT NULL DEFAULT 30,
|
||||
tag_dedup_threshold REAL NOT NULL DEFAULT 0.82,
|
||||
tag_expiry_days INTEGER NOT NULL DEFAULT 21,
|
||||
|
||||
@@ -4,7 +4,6 @@ import type { GlobalSettings } from './types.js';
|
||||
function rowToSettings(row: any): GlobalSettings {
|
||||
return {
|
||||
mergeStrictness: row.merge_strictness,
|
||||
defaultPollIntervalMinutes: row.default_poll_interval_minutes,
|
||||
holdBeforePublishMinutes: row.hold_before_publish_minutes,
|
||||
tagDedupThreshold: row.tag_dedup_threshold,
|
||||
tagExpiryDays: row.tag_expiry_days,
|
||||
@@ -72,7 +71,7 @@ export function updateSettings(patch: Partial<GlobalSettings>): GlobalSettings {
|
||||
// out of sync — node:sqlite binds each by its `$name` key, not position.
|
||||
db.prepare(
|
||||
`UPDATE global_settings SET
|
||||
merge_strictness=$merge_strictness, default_poll_interval_minutes=$default_poll_interval_minutes,
|
||||
merge_strictness=$merge_strictness,
|
||||
hold_before_publish_minutes=$hold_before_publish_minutes,
|
||||
tag_dedup_threshold=$tag_dedup_threshold, tag_expiry_days=$tag_expiry_days,
|
||||
follow_up_min_hours_since_last=$follow_up_min_hours_since_last, follow_up_min_new_sources=$follow_up_min_new_sources,
|
||||
@@ -90,7 +89,6 @@ export function updateSettings(patch: Partial<GlobalSettings>): GlobalSettings {
|
||||
WHERE id = 1`
|
||||
).run({
|
||||
$merge_strictness: merged.mergeStrictness,
|
||||
$default_poll_interval_minutes: merged.defaultPollIntervalMinutes,
|
||||
$hold_before_publish_minutes: merged.holdBeforePublishMinutes,
|
||||
$tag_dedup_threshold: merged.tagDedupThreshold,
|
||||
$tag_expiry_days: merged.tagExpiryDays,
|
||||
|
||||
@@ -89,12 +89,11 @@ export function markPolled(id: string, error: string | null) {
|
||||
);
|
||||
}
|
||||
|
||||
/** Sources due for polling right now, based on their own interval (or the global default). */
|
||||
export function sourcesDueForPoll(defaultIntervalMinutes: number): Source[] {
|
||||
/** Sources due for polling right now, based on their own interval. */
|
||||
export function sourcesDueForPoll(): Source[] {
|
||||
const now = Date.now();
|
||||
return listEnabledSources().filter((s) => {
|
||||
if (!s.lastPolledAt) return true;
|
||||
const interval = (s.pollIntervalMinutes || defaultIntervalMinutes) * 60_000;
|
||||
return now - new Date(s.lastPolledAt).getTime() >= interval;
|
||||
return now - new Date(s.lastPolledAt).getTime() >= s.pollIntervalMinutes * 60_000;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -265,7 +265,6 @@ export interface Bookmark {
|
||||
|
||||
export interface GlobalSettings {
|
||||
mergeStrictness: 1 | 2 | 3 | 4 | 5;
|
||||
defaultPollIntervalMinutes: number;
|
||||
holdBeforePublishMinutes: number;
|
||||
tagDedupThreshold: number;
|
||||
tagExpiryDays: number;
|
||||
|
||||
Reference in New Issue
Block a user