fix npe syncing wallet normally for duration

This commit is contained in:
woodser 2024-01-21 08:00:31 -05:00
parent 6dc9842253
commit e4e8f5d311

View File

@ -836,7 +836,9 @@ public abstract class Trade implements Tradable, Model {
// reset wallet refresh period after duration
new Thread(() -> {
GenUtils.waitFor(syncNormalDuration);
if (!isShutDown && System.currentTimeMillis() >= syncNormalStartTimeMs + syncNormalDuration) {
Long syncNormalStartTimeMsCopy = syncNormalStartTimeMs; // copy to avoid race condition
if (syncNormalStartTimeMsCopy == null) return;
if (!isShutDown && System.currentTimeMillis() >= syncNormalStartTimeMsCopy + syncNormalDuration) {
syncNormalStartTimeMs = null;
updateWalletRefreshPeriod();
}