• Julien Muchembled's avatar
    client: fix the count of history items in the cache · e61b017f
    Julien Muchembled authored
    Cache items are stored in double-linked chains. In order to quickly know the
    number of history items, an extra attribute is used to count them. It was not
    always decremented when a history item was removed.
    
    This led to the following exception:
      <ClientCache history_size=100000 oid_count=1959 size=20970973 time=2849049 queue_length=[1, 7, 738, 355, 480, 66, 255, 44, 3, 5, 2, 1, 3, 4, 2, 2] (life_time=10000 max_history_size=100000 max_size=20971520)>
      poll raised, retrying
      Traceback (most recent call last):
        ...
        File "neo/client/handlers/master.py", line 137, in packetReceived
          cache.store(oid, data, tid, None)
        File "neo/client/cache.py", line 247, in store
          self._add(head)
        File "neo/client/cache.py", line 129, in _add
          self._remove(head)
        File "neo/client/cache.py", line 136, in _remove
          level = item.level
      AttributeError: 'NoneType' object has no attribute 'level'
    e61b017f
cache.py 11.8 KB