Skip to content

Commit

Permalink
Merge pull request #20 from SOBotics/hotfix/false-alerts
Browse files Browse the repository at this point in the history
Hotfix/false alerts
  • Loading branch information
FelixSFD authored Jan 25, 2017
2 parents fef9631 + 96b3584 commit d06900f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>de.felixsfd.stackoverflow</groupId>
<artifactId>guttenberg</artifactId>
<version>0.1.0</version>
<version>0.1.1</version>

<dependencies>
<dependency>
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/org/sobotics/guttenberg/clients/Guttenberg.java
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ public void start() {


executorService.scheduleAtFixedRate(()->execute(), 0, 59, TimeUnit.SECONDS);
executorService.scheduleAtFixedRate(()->checkLastExecution(), 30, 5, TimeUnit.MINUTES);
executorService.scheduleAtFixedRate(()->checkLastExecution(), 3, 5, TimeUnit.MINUTES);
}

private void execute() {
Expand Down Expand Up @@ -166,16 +166,16 @@ private void checkLastExecution() {
return;

Instant now = Instant.now();
Instant lastSuccess = StatusUtils.lastSucceededExecutionStarted;
Instant lastSuccess = StatusUtils.lastExecutionFinished;

//long difference = lastSuccess.getEpochSecond() - now.getEpochSecond();
long difference = now.getEpochSecond() - lastSuccess.getEpochSecond();

Instant criticalDate = now.minus(15, ChronoUnit.MINUTES);
//Instant criticalDate = now.minus(15, ChronoUnit.MINUTES);

if (criticalDate.isBefore(lastSuccess)) {
if (difference > 15*60) {
for (Room room : this.chatRooms) {
if (room.getRoomId() == 111347) {
room.send("@FelixSFD I didn't work correctly for the last 15 minutes! Please help me!");
room.send("@FelixSFD Please help me! The last successful execution finished at "+StatusUtils.lastExecutionFinished);
StatusUtils.askedForHelp = true;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/org/sobotics/guttenberg/utils/PrintUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ public static String printDescription(){
return " [ [Guttenberg](https://github.com/SOBotics/Guttenberg) ] ";
}
public static String printStackAppsPost(){
return "No StackApps post yet";
return "[Guttenberg - A bot searching for plagiarism on Stack Overflow](http://stackapps.com/q/7197/43403)";
}
public static String printHelp(){
return "I'm a bot, searching for plagiarism on Stack Overflow. "+wikiLink()+" Use commands to view a list of commands.";
}
private static String wikiLink(){
return "The guide and the wiki for the project [are present here](https://github.com/SOBotics/Guttenberg). Well. Not really at the moment.";
return "The guide and the wiki for the project [are present here](https://github.com/SOBotics/Guttenberg/wiki).";
}
public static String printCommandHeader(){
return "The list of commands are as follows: "+wikiLink();
Expand Down

0 comments on commit d06900f

Please sign in to comment.