Compare commits

..

No commits in common. "c031fa5a43374c74f9e98871683938b33362ba19" and "0aba323779e184b1df676e3be374949a6713f8d7" have entirely different histories.

2 changed files with 4 additions and 27 deletions

View file

@ -217,14 +217,6 @@ func (s *webServer) viewMetrics(w http.ResponseWriter, r *http.Request) {
fmt.Fprintf(w, "# HELP sem_vacuum_high_reached Whether a high vacuum has been reached (boolean)\n")
fmt.Fprintf(w, "# TYPE sem_vacuum_high_reached gauge\n")
fmt.Fprintf(w, "sem_vacuum_high_reached %f\n", boolToFloat(high))
fmt.Fprintf(w, "# HELP sem_rp_operating_seconds_total Operating time of the roughing pump, in seconds\n")
fmt.Fprintf(w, "# TYPE sem_rp_operating_seconds_total counter\n")
fmt.Fprintf(w, "sem_rp_operating_seconds_total %f\n", state.rpOperatingTime.Seconds())
fmt.Fprintf(w, "# HELP sem_dp_operating_seconds_total Operating time of the diffusion pump, in seconds\n")
fmt.Fprintf(w, "# TYPE sem_dp_operating_seconds_total counter\n")
fmt.Fprintf(w, "sem_dp_operating_seconds_total %f\n", state.dpOperatingTime.Seconds())
}
func (s *webServer) viewRoughingPumpEnable(w http.ResponseWriter, r *http.Request) {

View file

@ -51,9 +51,6 @@ type daemonState struct {
rpOn bool
dpOn bool
rpOperatingTime time.Duration
dpOperatingTime time.Duration
vent momentaryOutput
pumpdown momentaryOutput
aboveRough thresholdOutput
@ -80,15 +77,11 @@ func (d *daemon) process(ctx context.Context) {
select {
case <-ticker.C:
now := time.Now()
var elapsed time.Duration = 0
if !lastRun.IsZero() {
elapsed = now.Sub(lastRun)
if elapsed > periodGrace {
klog.Warningf("Processing loop lag: took %s, want %s", elapsed, period)
}
if elapsed := now.Sub(lastRun); !lastRun.IsZero() && elapsed > periodGrace {
klog.Warningf("Processing loop lag: took %s, want %s", elapsed, period)
}
lastRun = now
if err := d.processOnce(ctx, elapsed); err != nil {
if err := d.processOnce(ctx); err != nil {
if errors.Is(err, ctx.Err()) {
return
} else {
@ -106,7 +99,7 @@ func (d *daemon) process(ctx context.Context) {
}
// processOnce runs the main loop step of succd.
func (d *daemon) processOnce(_ context.Context, elapsed time.Duration) error {
func (d *daemon) processOnce(_ context.Context) error {
v, err := d.adcPirani.Read()
if err != nil {
return fmt.Errorf("when reading ADC: %w", err)
@ -197,13 +190,5 @@ func (d *daemon) processOnce(_ context.Context, elapsed time.Duration) error {
}
}
// Update operating time counters
if d.rpOn && elapsed > 0 {
d.rpOperatingTime += elapsed
}
if d.dpOn && elapsed > 0 {
d.dpOperatingTime += elapsed
}
return nil
}