Skip to content

Commit

Permalink
change healthcheck program request to 10 from 1 to avoid 0 programs r…
Browse files Browse the repository at this point in the history
…eturned.
  • Loading branch information
rmbarnett-rice committed Aug 11, 2017
1 parent e1e96ed commit 4c44182
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
* Created by barnett on 4/7/17.
Expand Down Expand Up @@ -70,21 +71,36 @@ protected void doGet(HttpServletRequest req, HttpServletResponse resp)
" } \n" +
"}";

Iterable<String> results = _synthesisStrategy.synthesise(code, 1);
Iterable<String> results = _synthesisStrategy.synthesise(code, 10);

if (!results.iterator().hasNext())
{
_logger.error("health check failed due to empty results.");
String msg = "health check failed due to empty results.";
_logger.error(msg);
resp.setStatus(HttpStatus.INTERNAL_SERVER_ERROR_500);
resp.getWriter().write(msg);
}
else
{
resp.getWriter().write("Ok.");
}

resp.getWriter().write("Ok.");

}
catch (Throwable e)
{
_logger.error("health check failed due to exception", e);
String msg = "health check failed due to exception";
_logger.error(msg, e);
resp.setStatus(HttpStatus.INTERNAL_SERVER_ERROR_500);

try
{
resp.getWriter().write(msg);
}
catch (IOException e1)
{
// do nothing. Will have blank message as page.
}
}

_logger.debug("exiting");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ private Iterable<String> synthesiseHelp(String code, int maxProgramCount, Intege
List<String> synthesizedPrograms;
try
{
_logger.trace("astsJson: " + astsJson);
synthesizedPrograms = _synthesizer.synthesize(code, astsJson);
_logger.trace("synthesizedPrograms: " + synthesizedPrograms);

Expand Down

0 comments on commit 4c44182

Please sign in to comment.