• Julien Muchembled's avatar
    Fix sorting of delayed events · 40bac312
    Julien Muchembled authored
    The initial intention was to rely on stable sorting when several events have
    the same key. For this to happen, sorting must not continue the comparison with
    the second item of events.
    
    This could lead to data corruption (conflict resolution with wrong base):
    
      FAIL: testNotifyReplicated (neo.tests.threaded.test.Test)
      ----------------------------------------------------------------------
      Traceback (most recent call last):
        File "neo/tests/threaded/__init__.py", line 1093, in wrapper
          return wrapped(self, cluster, *args, **kw)
        File "neo/tests/threaded/test.py", line 2019, in testNotifyReplicated
          self.assertEqual([15, 11, 13, 16], [r[x].value for x in 'abcd'])
        File "neo/tests/__init__.py", line 187, in assertEqual
          return super(NeoTestBase, self).assertEqual(first, second, msg=msg)
      failureException: Lists differ: [15, 11, 13, 16] != [19, 11, 13, 16]
    
      First differing element 0:
      15
      19
    
      - [15, 11, 13, 16]
      ?   ^
    
      + [19, 11, 13, 16]
      ?   ^
    40bac312
handler.py 12.8 KB