Repository navigation
Conversation
* add reloader worker to templatemailer with periodic refresh; keeps serving last-good entries on fetch/parse errors and falls back to built-in defaults; never drops an entry before an update is ready * introduce FromConfig builder plus Reload and ReloadConfig; server builds via FromConfig, starts Work() when enabled, and triggers reloads on config changes * add config knobs: TemplateMaxSize, TemplateMaxAge, TemplateRetryIval, TemplateReloadingEnabled, TemplateReloadingMaxIdle * implement idle pause/resume: reloader sleeps after a quiet period and resumes on cache touch from mail() paths. * enforce HTTP 200 and cap body size when fetching templates * no client changes beyond phase 2, written to preserve existing behavior
Contributor
Let's use |
added 2 commits
September 3, 2025 14:47
* Addresses feedback Ival -> Interval * Eagerly reload templates in work loop instead of waiting on tr * Previous PR persisted the mailer, which meant mailer.Client would not have been updated from live config reloads. * Previous PR did not update the ticker interval in Work. * Cleaner scoping of config allows removal of sync in templatemailer
Pull Request Test Coverage Report for Build 17447151393Details
💛 - Coveralls |
Contributor
Author
|
I'll commit my tests and add some additional ones to bring up coverage, wanted to get PR up for eyes on changes. |
hf
approved these changes
Sep 4, 2025
6 tasks done
2 tasks done
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR builds on auth#2150 to deliver phase 3: background template
reloading. Templates are proactively refreshed in the background while the
request path serves from cache. On failures we keep serving last-good entries or
fall back to built-in defaults. This further reduces latency variance, removes
blocking fetches on hot paths, and preserves current behavior.
Background reloader
templatemailerthat periodically refreshes cached templates.Hot-reload & wiring
FromConfigbuilder andReload/ReloadConfighooks.FromConfig, startsWork()when enabled, and triggers reloads on config changes (no request downtime).$messageTypesubstitution and legacy "reauthenticate" compatibility.Configuration knobs
TemplateMaxSize– maximum template body size to fetch and parse.TemplateMaxAge– cache TTL before an entry is considered stale.TemplateRetryIval– interval used to recheck/retry stale entries.TemplateReloadingEnabled– gate to start the background worker.TemplateReloadingMaxIdle– pause background work after this period of inactivity, resume on cache "touch" from incoming requests.Interfaces & compatibility
subjectandbody. Task payloads unchanged from the prior PR.WithMailer