Reset Discord state if now > updated + timeout

Correctly reset Discord state only if now > updated + timeout instead of
updated > start + timeout.

Signed-off-by: Tomas Slusny <slusnucky@gmail.com>
This commit is contained in:
Tomas Slusny
2018-07-04 16:45:59 +02:00
parent b4d836a903
commit 34e95cdafe

View File

@@ -153,7 +153,7 @@ class DiscordState
void checkForTimeout()
{
final Duration actionTimeout = Duration.ofMinutes(config.actionTimeout());
events.removeIf(event -> event.getType().isShouldTimeout() &&
event.getUpdated().isAfter(event.getStart().plus(actionTimeout)));
final Instant now = Instant.now();
events.removeIf(event -> event.getType().isShouldTimeout() && now.isAfter(event.getUpdated().plus(actionTimeout)));
}
}