Browse Source

define persistence interval in a constant

Malte Kraus 8 năm trước cách đây
mục cha
commit
5047699ac1
1 tập tin đã thay đổi với 3 bổ sung1 xóa
  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