Lottery end time should not be scheduled in the past.

This commit is contained in:
MobiusDevelopment
2022-10-31 22:24:01 +00:00
parent 259bde1f0f
commit d4e60159b4
6 changed files with 38 additions and 32 deletions

View File

@ -189,8 +189,9 @@ public class Lottery
_enddate = finishtime.getTimeInMillis();
}
ThreadPool.schedule(new stopSellingTickets(), _enddate - System.currentTimeMillis() - (10 * MINUTE));
ThreadPool.schedule(new finishLottery(), _enddate - System.currentTimeMillis());
final long endDate = _enddate - System.currentTimeMillis();
ThreadPool.schedule(new stopSellingTickets(), Math.max(endDate - (10 * MINUTE), 0));
ThreadPool.schedule(new finishLottery(), Math.max(endDate, 0));
try (Connection con = DatabaseFactory.getConnection())
{