Show More
@@ -2142,7 +2142,13 b' class CacheInvalidation(Base, BaseModel)' | |||||
2142 | return True |
|
2142 | return True | |
2143 | inv_obj.cache_active = True |
|
2143 | inv_obj.cache_active = True | |
2144 | Session().add(inv_obj) |
|
2144 | Session().add(inv_obj) | |
2145 | Session().commit() |
|
2145 | try: | |
|
2146 | Session().commit() | |||
|
2147 | except exc.IntegrityError: | |||
|
2148 | inv_obj = cls.query().filter(cls.cache_key == cache_key).scalar() | |||
|
2149 | if not inv_obj: | |||
|
2150 | raise | |||
|
2151 | # TOCTOU - another thread added the key at the same time; no further action required | |||
2146 | return False |
|
2152 | return False | |
2147 |
|
2153 | |||
2148 | @classmethod |
|
2154 | @classmethod |
General Comments 0
You need to be logged in to leave comments.
Login now