✨ Fix bug with timeouts
This commit is contained in:
parent
ac3c75dbdf
commit
282a12111c
@ -19,6 +19,7 @@ import java.io.InputStreamReader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@ApplicationScoped
|
||||
public class NodeService implements ResourceService<NodeStats>
|
||||
@ -82,12 +83,17 @@ public class NodeService implements ResourceService<NodeStats>
|
||||
text.add(line);
|
||||
}
|
||||
}
|
||||
boolean hasEndedInTime = p.waitFor(10, TimeUnit.SECONDS);
|
||||
p.destroy();
|
||||
if (hasEndedInTime)
|
||||
{
|
||||
int exitCode = p.waitFor();
|
||||
if(exitCode == 0)
|
||||
{
|
||||
LOG.info("Found {} nodes", text.size());
|
||||
return text;
|
||||
}
|
||||
}
|
||||
throw new RuntimeException("Failed to retrieve top nodes.");
|
||||
}
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user