mirror of https://github.com/zulip/zulip.git
Revert "event: Add deduplication of server restart events."
This reverts commit 05467929ba376a0ce173119c5d90d83671fc544b. (imported from commit 4f24a0f1fe72e71fa368e1d818d9406a76c131be)
This commit is contained in:
parent
2c2f404cb6
commit
5b601d8492
|
@ -154,7 +154,7 @@ def compute_full_event_type(event):
|
|||
|
||||
# Virtual events are a mechanism for storing pointer changes and other
|
||||
# easily collapsed event types efficiently.
|
||||
VIRTUAL_EVENT_TYPES = ["pointer", "read/add", "restart"]
|
||||
VIRTUAL_EVENT_TYPES = ["pointer", "read/add"]
|
||||
class EventQueue(object):
|
||||
def __init__(self, id):
|
||||
self.queue = deque()
|
||||
|
@ -193,8 +193,6 @@ class EventQueue(object):
|
|||
virtual_event["pointer"] = event["pointer"]
|
||||
elif full_event_type == "read/add":
|
||||
virtual_event["messages"] += event["messages"]
|
||||
elif full_event_type == "restart":
|
||||
virtual_event["server_generation"] = event["server_generation"]
|
||||
else:
|
||||
self.queue.append(event)
|
||||
|
||||
|
|
|
@ -2506,22 +2506,17 @@ class EventQueueTest(TestCase):
|
|||
"pointer": pointer_val,
|
||||
"timestamp": str(pointer_val)})
|
||||
queue.push({"type": "unknown"})
|
||||
queue.push({"type": "restart", "server_generation": "1"})
|
||||
for pointer_val in xrange(11, 20):
|
||||
queue.push({"type": "pointer",
|
||||
"pointer": pointer_val,
|
||||
"timestamp": str(pointer_val)})
|
||||
queue.push({"type": "restart", "server_generation": "2"})
|
||||
self.assertEqual(queue.contents(),
|
||||
[{"type": "unknown",
|
||||
"id": 9,},
|
||||
{'id': 19,
|
||||
{'id': 18,
|
||||
'type': 'pointer',
|
||||
"pointer": 19,
|
||||
"timestamp": "19"},
|
||||
{"id": 20,
|
||||
"type": "restart",
|
||||
"server_generation": "2"}])
|
||||
"timestamp": "19"}])
|
||||
for pointer_val in xrange(21, 23):
|
||||
queue.push({"type": "pointer",
|
||||
"pointer": pointer_val,
|
||||
|
@ -2529,18 +2524,14 @@ class EventQueueTest(TestCase):
|
|||
self.assertEqual(queue.contents(),
|
||||
[{"type": "unknown",
|
||||
"id": 9,},
|
||||
{'id': 19,
|
||||
{'id': 18,
|
||||
'type': 'pointer',
|
||||
"pointer": 19,
|
||||
"timestamp": "19"},
|
||||
{"id": 20,
|
||||
"type": "restart",
|
||||
"server_generation": "2"},
|
||||
{'id': 22,
|
||||
{'id': 20,
|
||||
'type': 'pointer',
|
||||
"pointer": 22,
|
||||
"timestamp": "22"},
|
||||
])
|
||||
"timestamp": "22"},])
|
||||
|
||||
def test_flag_collapsing(self):
|
||||
queue = EventQueue("1")
|
||||
|
|
Loading…
Reference in New Issue