mirror of
https://github.com/Pasta-Devs/Marinara-Engine.git
synced 2026-12-03 19:00:50 +07:00
[GH-ISSUE #4630] [Issue]: Noodler reserve reconciler full-scans noodle tables every 60s even when automatic posting is disabled #2530
Labels
No labels
android
bug
bugfix
ci
client
code freeze pause
container
dependencies
docs
documentation
duplicate
enhancement
feature
feature
feature
feature-creep
fixed-in-refactor
fixed-in-staging
good first issue
help wanted
in-pr
in-pr
needs-codeowner-decision
normal-scope
old-codebase
old-codebase
pull-request
qol
question
refactor
regression
revisit later
roadmap
scope-risk
scope-risk
server
server
shared
soup
upstream
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Pasta-Devs/Marinara-Engine#2530
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @kolacheee on GitHub (Aug 5, 2026).
Original GitHub issue: https://github.com/Pasta-Devs/Marinara-Engine/issues/4630
Originally assigned to: @Gunterlie on GitHub.
Summary
The Noodler reserve scheduler full-scans the
noodlerPreparedPostsandnoodlePoststables (with per-row JSON parsing), plus re-lists prepared posts and both account tables, every 60 seconds, forever, even when Noodler/automatic posting is disabled and the tables are empty. On the file-native store these are full table materializations — a permanent idle CPU tick that matters most on phone/Termux installs.Expected behavior
The periodic reconcile tick early-exits (or backs off) when automatic posting is disabled and there is no reserve state to reconcile. (The startup reconcile is intentionally unconditional — the scheduler comment explains upgrades must begin their hold even when posting is disabled — and should stay.)
Actual behavior
startNoodleAutoPostScheduler(packages/server/src/services/noodle/noodle-autopost-scheduler.service.ts:28-78) arms a 60 s poll from 30 s after boot.poll()callsreconcileNoodlerReserve(app.db)(line 50) before any enabled/settings check — the only gate is the backup-pause (pauseDepth).reconcileNoodlerReserve→reconcileNoodlerPreparedPosts(packages/server/src/services/storage/noodle.storage.ts:2018-2068): loads settings at line 2019 but does not consult them before scanning — it opens a transaction and runstx.select().from(noodlerPreparedPosts)+tx.select().from(noodlePosts)(lines 2021-2024), thenparseRecord(post.metadata)(JSON.parse) for every post row (line 2027). After the transaction it does a second round of full reads:listNoodlerPreparedPosts()+listAccounts()+listNoodlerAccounts()(lines 2065-2068).publishDueNoodlerPreparedPosts(line 1900) runs as well.Every 60 seconds, with zero connected clients, feature disabled, and nothing to reconcile. On an active Noodle install (many
noodlePostsrows) each tick JSON-parses every post's metadata — on the file-native store there is no index, so this is O(all posts) per minute for the server's lifetime.Steps to reproduce
reconcileNoodlerPreparedPosts.Environment
93738d9b1)Logs, screenshots, or video
Code trace above (line references verified against current staging).
Additional context
Found during a mobile-battery investigation (two user reports: browser-client heat + Termux baseline drain). Related sibling pattern worth a look in the same pass: the Noodle timeline-refresh scheduler also wakes every 60 s when
refreshesPerDay === 0instead of backing off.Suggested fix: in the periodic
poll()(not the startup pass), check settings first and early-exit when automatic posting is disabled and a cheap count ofnoodlerPreparedPostsis zero; alternatively back the poll off (e.g. 15 min) while disabled. The startup reconcile keeps its current unconditional behavior per the scheduler's own comment.Filed alongside #4628 (assistant streaming) and #4629 (extension runtime polling).
Template check
@Gunterlie commented on GitHub (Aug 5, 2026):
Picked this up — draft PR #4635 (branch
noodler-for-the-cpu-poor) covers both the reserve poll early-exit and the disabled timeline-refresh backoff. Owner: @Gunterlie.