The order in an OrderedDict is based on the order of original insertion. If you modify an item, even though the expiry is changed, it stays in the same position as it originally was. This can cause the wrong items to be dropped.
The solution would be to first delete the item before setting it in set item.
The order in an OrderedDict is based on the order of original insertion. If you modify an item, even though the expiry is changed, it stays in the same position as it originally was. This can cause the wrong items to be dropped.
The solution would be to first delete the item before setting it in set item.