Implement indexing into Apache Druid #1
12
core/bot.py
12
core/bot.py
|
@ -221,8 +221,8 @@ class IRCBot(IRCClient):
|
|||
del main.TempChan[self.net]
|
||||
|
||||
def event(self, **cast):
|
||||
if not "time" in cast.keys():
|
||||
cast["time"] = str(datetime.now().isoformat())
|
||||
if not "ts" in cast.keys():
|
||||
cast["ts"] = str(datetime.now().isoformat())
|
||||
|
||||
# remove odd stuff
|
||||
for i in list(cast.keys()): # Make a copy of the .keys() as Python 3 cannot handle iterating over
|
||||
|
@ -699,7 +699,7 @@ class IRCBot(IRCClient):
|
|||
"net": self.net,
|
||||
"num": self.num,
|
||||
"status": "signedon",
|
||||
"time": ctime,
|
||||
"ts": ctime,
|
||||
}
|
||||
)
|
||||
if not self.authenticated:
|
||||
|
@ -747,7 +747,7 @@ class IRCBot(IRCClient):
|
|||
self.event(type="kick", muser=kicker, channel=channel, msg=message, user=kickee)
|
||||
|
||||
def chanlessEvent(self, cast):
|
||||
cast["time"] = str(datetime.now().isoformat())
|
||||
cast["ts"] = str(datetime.now().isoformat())
|
||||
cast["nick"], cast["ident"], cast["host"] = parsen(cast["muser"])
|
||||
if dedup(self.name, cast): # Needs to be kept self.name until the dedup
|
||||
# function is converted to the new net, num
|
||||
|
@ -834,7 +834,7 @@ class IRCBotFactory(ReconnectingClientFactory):
|
|||
"num": self.num,
|
||||
"status": "lost",
|
||||
"message": error,
|
||||
"time": ctime,
|
||||
"ts": ctime,
|
||||
}
|
||||
)
|
||||
self.retry(connector)
|
||||
|
@ -857,7 +857,7 @@ class IRCBotFactory(ReconnectingClientFactory):
|
|||
"num": self.num,
|
||||
"status": "failed",
|
||||
"message": error,
|
||||
"time": ctime,
|
||||
"ts": ctime,
|
||||
}
|
||||
)
|
||||
self.retry(connector)
|
||||
|
|
|
@ -24,7 +24,7 @@ order = [
|
|||
"realname",
|
||||
"server",
|
||||
"status",
|
||||
"time",
|
||||
"ts",
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -8,8 +8,8 @@ from utils.logging.debug import debug
|
|||
|
||||
def dedup(numName, b):
|
||||
c = deepcopy(b)
|
||||
if "time" in c.keys():
|
||||
del c["time"]
|
||||
if "ts" in c.keys():
|
||||
del c["ts"]
|
||||
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"]
|
||||
|
|
Loading…
Reference in New Issue