Flask remove session variable from thread

前端 未结 1 2014

I try to implement a voting system. It works like this. If a user votes a post I record its temporary state in a session variable: upvoted, starred etc..

If current user

相关标签:
1条回答
  • 2021-01-25 22:59

    No, it's not possible. The request is over, the session in that thread is essentially a read-only copy. Writing to it won't do anything because there's no response to carry the updated cookie to the browser.

    It would make more sense to store the timestamp in the temporary table when you store the temporary vote, rather than trying to do something with threads and the session.

    0 讨论(0)
提交回复
热议问题