Quellcode durchsuchen

deadlock is in seconds

tags/2.0.1
Jonathan Cobb vor 4 Jahren
Ursprung
Commit
8d96a767b8
1 geänderte Dateien mit 4 neuen und 2 gelöschten Zeilen
  1. +4
    -2
      wizard-server/src/main/java/org/cobbzilla/wizard/cache/redis/RedisService.java

+ 4
- 2
wizard-server/src/main/java/org/cobbzilla/wizard/cache/redis/RedisService.java Datei anzeigen

@@ -220,10 +220,12 @@ public class RedisService {
String lockVal = get(key);
final long start = now();
while ((lockVal == null || !lockVal.equals(uuid)) && (now() - start < lockTimeout)) {
set(key, uuid, NX, EX, deadlockTimeout);
set(key, uuid, NX, EX, deadlockTimeout/1000);
lockVal = get(key);
}
if (lockVal == null || !lockVal.equals(uuid)) return die("lock: timeout locking "+key);
if (lockVal == null || !lockVal.equals(uuid)) {
return die("lock: timeout locking "+key);
}
log.info("lock: LOCKED "+key);
return uuid;
}


Laden…
Abbrechen
Speichern