Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
We've had a problem where deleting session items, particularly flash messages, does not seem to work in some environments. In our dev and staging environments, we see this bug, where the flash messages pile up from pageview to pageview and don't want to go away. For some reason it isn't an issue in production; I'm not sure why. In any case, when I found what appeared to be causing the bug, it seemed fairly clear to me that it is a bug. The triggering of
channel.backend_write()
happens with aset
, but not with adel
. So I've added that call in__delitem__
to make sure it persists its changes. I refactored the conditional call tobackend_write
into a named method just to avoid duplicating the accompanying comment. I also made this call tobackend_write
optional when doing a delete, becauseset
actually does a delete first, and there is no point inset
doing two writes.So far this has only been manually tested by me.