Fix various bugs in the event system

Squash many bugs in the event notification system and simplify the
code.
This commit is contained in:
2020-06-02 21:34:15 +01:00
parent 8103c16253
commit 11f15ac960
4 changed files with 71 additions and 49 deletions

View File

@@ -1,11 +1,13 @@
from datetime import datetime
from csiphash import siphash24
from copy import deepcopy
from json import dumps
import main
from utils.logging.debug import debug
def dedup(numName, c):
# deduplication
def dedup(numName, b):
c = deepcopy(b)
del c["time"]
c["approxtime"] = str(datetime.utcnow().timestamp())[:main.config["Tweaks"]["DedupPrecision"]]
castHash = siphash24(main.hashKey, dumps(c, sort_keys=True).encode("utf-8"))
del c["approxtime"]