From a76cf7e3f8283ce33a8b74deb17e43dc5ee7df0e Mon Sep 17 00:00:00 2001
From: Itay Mizeretz <itay.mizeretz@guardicore.com>
Date: Fri, 19 Jan 2018 11:19:49 +0200
Subject: [PATCH] Always sort telemetry feed

---
 monkey_island/cc/resources/telemetry_feed.py | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/monkey_island/cc/resources/telemetry_feed.py b/monkey_island/cc/resources/telemetry_feed.py
index 8e4d68212..9a7e507ef 100644
--- a/monkey_island/cc/resources/telemetry_feed.py
+++ b/monkey_island/cc/resources/telemetry_feed.py
@@ -18,7 +18,8 @@ class TelemetryFeed(flask_restful.Resource):
             telemetries = mongo.db.telemetry.find({})
         else:
             telemetries = mongo.db.telemetry.find({'timestamp': {'$gt': dateutil.parser.parse(timestamp)}})\
-                .sort([('timestamp', flask_pymongo.ASCENDING)])
+
+        telemetries = telemetries.sort([('timestamp', flask_pymongo.ASCENDING)])
 
         return \
             {