From a5eaea879614969b42ce9b039972e8c4e4afaf60 Mon Sep 17 00:00:00 2001 From: Itay Mizeretz Date: Fri, 19 Jan 2018 10:58:24 +0200 Subject: [PATCH] Hotfix: live telemetry feed sorted by timestamp --- monkey_island/cc/resources/telemetry_feed.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/monkey_island/cc/resources/telemetry_feed.py b/monkey_island/cc/resources/telemetry_feed.py index 24e0dcc51..8e4d68212 100644 --- a/monkey_island/cc/resources/telemetry_feed.py +++ b/monkey_island/cc/resources/telemetry_feed.py @@ -3,6 +3,7 @@ from datetime import datetime import dateutil import flask_restful from flask import request +import flask_pymongo from cc.database import mongo from cc.services.node import NodeService @@ -16,7 +17,8 @@ class TelemetryFeed(flask_restful.Resource): if "null" == timestamp or timestamp is None: # special case to avoid ugly JS code... telemetries = mongo.db.telemetry.find({}) else: - telemetries = mongo.db.telemetry.find({'timestamp': {'$gt': dateutil.parser.parse(timestamp)}}) + telemetries = mongo.db.telemetry.find({'timestamp': {'$gt': dateutil.parser.parse(timestamp)}})\ + .sort([('timestamp', flask_pymongo.ASCENDING)]) return \ {