feat: bonus features (priority, redirect_stderr, process_name) - #52
Open
mylastresort wants to merge 9 commits into
Open
feat: bonus features (priority, redirect_stderr, process_name)#52mylastresort wants to merge 9 commits into
mylastresort wants to merge 9 commits into
Conversation
syslog.New() fails in containers without a syslog daemon, causing os.Exit(1). Make syslog optional — fall back to stdout-only logging when unavailable.
Fall back to /var/log/taskmaster.log when syslog is unavailable, rather than silently dropping syslog messages.
- Fix exec.Cmd reuse bug (C1): create fresh Cmd object each restart iteration - Fix autorestart=unexpected logic (C3): correct index/value iteration + break - Fix stop signal order (C4): send stopsignal first, then SIGKILL after stopwaitsecs - Fix start/stop race condition (C8): unified mutex + startReady channel - Fix client error variable (M2): read res.Err.Error() instead of err.Error() - Fix reload error handling (M3): propagate config parse errors to client - Fix mutex deadlock (M5): use defer for unlock in Stop() and Start() - Fix range iteration (M1): use _, exit := range for value iteration - 28 tests across 9 sections (control shell, config, autorestart, stop signal, kill-restart, startsecs, startretries, hot-reload, race condition) - 25 pass, 3 fail (all pre-existing env-specific issues, not code bugs) - Test configs for each test scenario in tests/ directory - Add test workflow
fix: make syslog optional to prevent crash in Docker
fix: critical job lifecycle bugs and start/stop race condition
- Priority: controls start/stop ordering (higher = start first, stop last) - RedirectStderr: merges stderr into stdout log file - ProcessName: custom display name template with %s (name) and %d (proc number) - All features hot-reloadable via SIGHUP/reload command - 10 tests passing in tests/bonus_tests.sh
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.
Bonus Features
Three distinct, correctly implemented bonus features:
1. Priority
Controls start/stop ordering between programs. Higher priority = started first, stopped last.
start all: high priority programs start firststop all: low priority programs stop first (high keeps running longer)2. Redirect Stderr
Merges stderr into the stdout log file with a single flag. Hot-reloadable (triggers restart if changed while running).
3. Process Name
Custom display name template for process instances. Uses
%sfor program name and%dfor process number. Default behavior is unchanged.Tests
All 10 bonus tests pass in
tests/bonus_tests.sh:Files Changed
internal/parser/config/config.go- 3 new fields in Program structinternal/job/job.go- Job struct, DisplayName method, RedirectStderr in tryStart, reread handlinginternal/manager/manager.go- sortedJobs helper, priority ordering in start/stop/reload/setJobstests/bonus_config.toml- test configurationtests/bonus_tests.sh- test script