mirror of
https://github.com/tiennm99/tiennm99bot.git
synced 2026-10-19 14:16:26 +00:00
refactor(server): drop HTTP /cron route; run crons in-process only
The in-process scheduler is the sole cron trigger on self-host, so the
/cron/{name} HTTP endpoint and its CRON_SHARED_SECRET are dead surface.
Reduce the HTTP server to GET / (health) and remove the cron secret config,
SSM binding, and now-unused timeout.
This commit is contained in:
1 parent
15a3239ab1
commit
cc547136b7
6 files changed
+18
-263
No files matched your search
@@ -6,16 +6,16 @@ import (
|
||||
"fmt"
|
||||
)
|
||||
|
||||
// ErrCronNotFound is returned when /cron/{name} addresses an unregistered cron.
|
||||
// ErrCronNotFound is returned when name addresses an unregistered cron.
|
||||
var ErrCronNotFound = errors.New("cron not found")
|
||||
|
||||
// DispatchScheduled runs the cron registered under name with the per-module
|
||||
// prefixed Deps the registry stored at Build time. Returns ErrCronNotFound if
|
||||
// no module owns that name — EventBridge Scheduler hitting an unknown route is a
|
||||
// configuration bug worth surfacing as a 404 at the HTTP layer.
|
||||
// no module owns that name — a scheduler firing an unknown name is a
|
||||
// configuration bug worth surfacing to the caller.
|
||||
//
|
||||
// The handler runs synchronously in the calling goroutine; ctx propagates
|
||||
// cancellation/timeout from the HTTP request.
|
||||
// the scheduler's per-fire cancellation/timeout.
|
||||
func DispatchScheduled(ctx context.Context, name string, reg *Registry) error {
|
||||
cron, ok := reg.Cron(name)
|
||||
if !ok {
|
||||
|
||||
Reference in new issue
Block a user