Commit b94d69c9 authored by Hiro's avatar Hiro 🏄
Browse files

Fix bug with timestamp in dictionary

parent 6ffa68c9
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -10,7 +10,12 @@ from prometheus_client import CollectorRegistry, Gauge, write_to_textfile

def __check_time_delta(node, field, interval):
    if node.get(field):
        timestamp = 0
        if type(node.get(field)) is int:
            timestamp = datetime.fromtimestamp(node.get(field)/1000)
        else:
            timestamp = datetime.fromtimestamp(node.get(field).get('timestamp')/1000)

        if (datetime.utcnow() - timestamp) < timedelta(hours=interval):
            return True
        else: