Re-add write_to_es function

This commit is contained in:
Mark Veidemanis 2022-05-05 18:26:25 +01:00
parent c31175fea0
commit be3b97ae42
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
1 changed files with 7 additions and 0 deletions

View File

@ -68,6 +68,13 @@ class Money(util.Base):
self.lc_es_checks.start(delay)
self.agora.es = self.es
def write_to_es(self, msgtype, cast):
if settings.ES.Enabled == "1":
cast["type"] = msgtype
cast["ts"] = str(datetime.now().isoformat())
cast["xtype"] = "tx"
self.es.index(index=settings.ES.Index, document=cast)
def lookup_rates(self, platform, ads, rates=None):
"""
Lookup the rates for a list of public ads.