mirror of
https://github.com/sparrowwallet/sparrow.git
synced 2024-12-25 05:06:45 +00:00
add logging when event wallet id is not present
This commit is contained in:
parent
34d1571669
commit
34b4c39ccd
1 changed files with 8 additions and 2 deletions
|
@ -1,12 +1,16 @@
|
||||||
package com.sparrowwallet.sparrow.event;
|
package com.sparrowwallet.sparrow.event;
|
||||||
|
|
||||||
import com.sparrowwallet.sparrow.io.Config;
|
import com.sparrowwallet.sparrow.io.Config;
|
||||||
|
import org.slf4j.Logger;
|
||||||
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public class StorageEvent extends TimedEvent {
|
public class StorageEvent extends TimedEvent {
|
||||||
|
private static final Logger log = LoggerFactory.getLogger(StorageEvent.class);
|
||||||
|
|
||||||
private static boolean firstRunDone = false;
|
private static boolean firstRunDone = false;
|
||||||
private static final Map<String, Long> eventTime = new HashMap<>();
|
private static final Map<String, Long> eventTime = new HashMap<>();
|
||||||
|
|
||||||
|
@ -22,8 +26,10 @@ public class StorageEvent extends TimedEvent {
|
||||||
eventTime.put(walletId, System.currentTimeMillis());
|
eventTime.put(walletId, System.currentTimeMillis());
|
||||||
timeMills = keyDerivationPeriod;
|
timeMills = keyDerivationPeriod;
|
||||||
} else if(action == Action.END) {
|
} else if(action == Action.END) {
|
||||||
long start = eventTime.get(walletId);
|
Long start = eventTime.get(walletId);
|
||||||
if(firstRunDone) {
|
if(start == null) {
|
||||||
|
log.error("Could not find start event time for wallet id " + walletId);
|
||||||
|
} else if(firstRunDone) {
|
||||||
keyDerivationPeriod = (int)(System.currentTimeMillis() - start);
|
keyDerivationPeriod = (int)(System.currentTimeMillis() - start);
|
||||||
Config.get().setKeyDerivationPeriod(keyDerivationPeriod);
|
Config.get().setKeyDerivationPeriod(keyDerivationPeriod);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue