Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
mawinter69 committed Oct 17, 2023
1 parent 43569ea commit 629bb74
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ public DiskSpace markNodeOfflineIfDiskspaceIsTooLow(Computer c) {
long threshold = getThresholdBytes(c);
if (size != null) {
size.setThreshold(threshold);
size.setWarningThreshold(getWarningThresholdBytes(c));
long warningThreshold = getWarningThresholdBytes(c);
size.setWarningThreshold(warningThreshold);
if (size.size < threshold) {
size.setTriggered(this.getClass(), true);
if (getDescriptor().markOffline(c, size)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@

package hudson.node_monitors;

import edu.umd.cs.findbugs.annotations.CheckForNull;
import hudson.Util;
import hudson.model.AdministrativeMonitor;
import hudson.model.Computer;
Expand Down Expand Up @@ -293,6 +294,7 @@ private final class Record extends Thread {

private long timestamp;


Record() {
super("Monitoring thread for " + getDisplayName() + " started on " + new Date());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@
package hudson.node_monitors;

import hudson.Functions;
import hudson.model.AdministrativeMonitor;
import hudson.model.Computer;
import hudson.node_monitors.DiskSpaceMonitorDescriptor.DiskSpace;
import hudson.remoting.VirtualChannel;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.text.ParseException;
import java.util.Locale;
import java.util.logging.Level;
import java.util.logging.Logger;
import jenkins.MasterToSlaveFileCallable;
import jenkins.model.Jenkins;
import org.kohsuke.accmod.Restricted;
import org.kohsuke.accmod.restrictions.DoNotUse;
import org.kohsuke.accmod.restrictions.NoExternalUse;
Expand All @@ -46,6 +51,7 @@
* @since 1.520
*/
public abstract class DiskSpaceMonitorDescriptor extends AbstractAsyncNodeMonitorDescriptor<DiskSpace> {

/**
* Value object that represents the disk space.
*/
Expand Down Expand Up @@ -124,7 +130,7 @@ public boolean isTriggered() {

@Restricted(NoExternalUse.class)
public boolean isWarning() {
return warningThreshold > 0 && size < warningThreshold;
return size > threshold && size < warningThreshold ;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
*/
@Extension
public class MonitorMarkedNodeOffline extends AdministrativeMonitor {

@Override
public String getDisplayName() {
return Messages.MonitorMarkedNodeOffline_DisplayName();
Expand Down

0 comments on commit 629bb74

Please sign in to comment.