Procházet zdrojové kódy

define persistence interval in a constant

Malte Kraus před 8 roky
rodič
revize
5047699ac1
1 změnil soubory, kde provedl 3 přidání a 1 odebrání
  1. 3 1
      src/persistence.py

+ 3 - 1
src/persistence.py

@@ -8,7 +8,9 @@ import gzip
 import time
 from io import TextIOWrapper
 from threading import Condition, Thread
+from datetime import timedelta
 
+PERSISTENCE_MIN_INTERVAL = timedelta(seconds=5)
 
 class Persistence:
     """
@@ -85,6 +87,6 @@ class Persistence:
                 except Exception as e:
                     os.unlink(tmpf.name)
                     raise e
-            time.sleep(5)
+            time.sleep(PERSISTENCE_MIN_INTERVAL.total_seconds())
 
 from .chainbuilder import ChainBuilder