Commit e54894f
Eric Bower
·
2026-08-27 11:12:32 -0400 EDT
parent b953e91
fix: remove gc from monitor it just keeps deleting my sessions
1 files changed,
+1,
-19
M
main.go
M
main.go
+1,
-19
| ... | ... | @@ -72,7 +72,6 @@ type Cfg struct { | |
| 72 | 72 | Event string // event JSON passed via --event flag | |
| 73 | 73 | EventSource io.ReadCloser // when set, used directly as the event source (for testing) | |
| 74 | 74 | MonitorInterval time.Duration | |
| 75 | - | GCInterval time.Duration | |
| 76 | 75 | NewWorkspace WorkspaceFactory | |
| 77 | 76 | StatusOutput io.Writer // where status JSONL is written (default: os.Stdout) | |
| 78 | 77 | IncludeRunning bool // emit running status updates in addition to terminal |
| ... | ... | @@ -111,7 +110,6 @@ type Event struct { | |
| 111 | 110 | func NewCfg() (*Cfg, string, bool) { | |
| 112 | 111 | var keyLoc, certLoc, artifactDir, event string | |
| 113 | 112 | var monitorInterval time.Duration | |
| 114 | - | var gcInterval time.Duration | |
| 115 | 113 | var logLevel string | |
| 116 | 114 | var envVars envList | |
| 117 | 115 | var sessionPrefix string |
| ... | ... | @@ -122,7 +120,6 @@ func NewCfg() (*Cfg, string, bool) { | |
| 122 | 120 | flag.StringVar(&event, "event", "", "event JSON to run (alternative to reading from stdin)") | |
| 123 | 121 | flag.StringVar(&sessionPrefix, "prefix", "ci.", "session prefix filter for monitor (default: ci.)") | |
| 124 | 122 | flag.DurationVar(&monitorInterval, "monitor-interval", 5*time.Second, "interval for monitoring zmx sessions") | |
| 125 | - | flag.DurationVar(&gcInterval, "gc-interval", 10*time.Minute, "interval for garbage collection in monitor (0 to disable)") | |
| 126 | 123 | flag.StringVar(&logLevel, "log-level", "info", "log level: debug, info, warn, error") | |
| 127 | 124 | flag.Var(&envVars, "e", "environment variable in KEY=VAL format (can be specified multiple times)") | |
| 128 | 125 | flag.Var(&envVars, "env", "environment variable in KEY=VAL format (can be specified multiple times)") |
| ... | ... | @@ -170,7 +167,6 @@ func NewCfg() (*Cfg, string, bool) { | |
| 170 | 167 | ArtifactDir: artifactDir, | |
| 171 | 168 | Event: event, | |
| 172 | 169 | MonitorInterval: monitorInterval, | |
| 173 | - | GCInterval: gcInterval, | |
| 174 | 170 | IncludeRunning: includeRunning, | |
| 175 | 171 | HumanOutput: human, | |
| 176 | 172 | Wait: wait, |
| ... | ... | @@ -460,7 +456,6 @@ FLAGS | |
| 460 | 456 | -ck <path> SSH certificate public key | |
| 461 | 457 | -artifact-dir <path> Local directory to stage artifacts (default: /tmp/pici-artifacts) | |
| 462 | 458 | -monitor-interval <dur> Poll interval (default: 5s) | |
| 463 | - | -gc-interval <dur> Garbage collection interval (default: 10m, 0 to disable) | |
| 464 | 459 | -include-running Emit running status updates in addition to terminal (default: terminal only) | |
| 465 | 460 | -human Human-readable output instead of JSONL (for terminal, not piping) | |
| 466 | 461 | -log-level <level> Log level: debug, info, warn, error (default: info)`) |
| ... | ... | @@ -1175,18 +1170,10 @@ func runMonitor(cfg *Cfg) error { | |
| 1175 | 1170 | ticker := time.NewTicker(cfg.MonitorInterval) | |
| 1176 | 1171 | defer ticker.Stop() | |
| 1177 | 1172 | ||
| 1178 | - | // Optional GC ticker — runs garbage collection on a separate interval. | |
| 1179 | - | var gcChan <-chan time.Time | |
| 1180 | - | if cfg.GCInterval > 0 { | |
| 1181 | - | gcTicker := time.NewTicker(cfg.GCInterval) | |
| 1182 | - | defer gcTicker.Stop() | |
| 1183 | - | gcChan = gcTicker.C | |
| 1184 | - | } | |
| 1185 | - | ||
| 1186 | 1173 | // Track per-job display state across ticks (for human output) | |
| 1187 | 1174 | jobStates := make(map[string]*monitorJobState) // key: "name/jobID" | |
| 1188 | 1175 | ||
| 1189 | - | log.Debug("monitor started", "interval", cfg.MonitorInterval, "gc_interval", cfg.GCInterval, "artifact_dir", cfg.ArtifactDir) | |
| 1176 | + | log.Debug("monitor started", "interval", cfg.MonitorInterval, "artifact_dir", cfg.ArtifactDir) | |
| 1190 | 1177 | log.Debug("monitoring ci.* sessions for job status, writing status to stdout") | |
| 1191 | 1178 | ||
| 1192 | 1179 | for { |
| ... | ... | @@ -1198,11 +1185,6 @@ func runMonitor(cfg *Cfg) error { | |
| 1198 | 1185 | if err := monitorTick(cfg, log, output, jobStates); err != nil { | |
| 1199 | 1186 | log.Error("monitor tick", "err", err) | |
| 1200 | 1187 | } | |
| 1201 | - | case <-gcChan: | |
| 1202 | - | log.Debug("running periodic garbage collection") | |
| 1203 | - | if err := runGC(cfg); err != nil { | |
| 1204 | - | log.Error("periodic gc", "err", err) | |
| 1205 | - | } | |
| 1206 | 1188 | } | |
| 1207 | 1189 | } | |
| 1208 | 1190 | } |