Skip to content

Commit

Permalink
refactor: Add debug log for listenForRedis timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
WiIIiam278 committed Dec 21, 2023
1 parent f0c64df commit a6bab88
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
import org.jetbrains.annotations.ApiStatus;
import org.jetbrains.annotations.NotNull;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.atomic.AtomicLong;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Function;
Expand Down Expand Up @@ -114,6 +116,8 @@ protected void listenForRedisData(@NotNull OnlineUser user, @NotNull Supplier<Bo
}
if (plugin.isDisabling() || timesRun.getAndIncrement() > maxListenAttempts) {
task.get().cancel();
plugin.debug(String.format("[%s] [%s] Redis timed out after %s attempts; setting from database",
user.getUsername(), SimpleDateFormat.getDateTimeInstance().format(new Date()), timesRun.get()));
setUserFromDatabase(user);
return;
}
Expand Down

0 comments on commit a6bab88

Please sign in to comment.