Skip to content

Commit

Permalink
Fix caching of auto-created missing flags (#383)
Browse files Browse the repository at this point in the history
  • Loading branch information
simonlindholm authored Jan 17, 2021
1 parent 0ef9d30 commit 03d9783
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions waffle/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ def is_active(self, request):
}
)
cache = get_cache()
cache.add(self._cache_key(self.name), flag)
cache.set(self._cache_key(self.name), flag)

return get_setting('FLAG_DEFAULT')

Expand Down Expand Up @@ -453,7 +453,7 @@ def is_active(self):
}
)
cache = get_cache()
cache.add(self._cache_key(self.name), switch)
cache.set(self._cache_key(self.name), switch)

return get_setting('SWITCH_DEFAULT')

Expand Down Expand Up @@ -523,7 +523,7 @@ def is_active(self):
}
)
cache = get_cache()
cache.add(self._cache_key(self.name), sample)
cache.set(self._cache_key(self.name), sample)

return get_setting('SAMPLE_DEFAULT')
return Decimal(str(random.uniform(0, 100))) <= self.percent

0 comments on commit 03d9783

Please sign in to comment.