Fabien Schwebel  committed 9bd3c54

feature slowing down page generation switched off by default

  • Participants
  • Parent commits 928f7fd

Comments (0)

Files changed (2)

 ### Pros:
-* lightweight, designed not to slow down your website a single bit (from a non-miserable point of view, of course)
 * supports both IPv4 and IPv6
 ### Cons:
 * doesn't currently support masks. Yes, it can be handy against users having a botnet under their control or in case of a user having an IPv6 range, but the current implementation favors speed over features.
+* due to the way it is currently implemented, the feature slowing down page generation for miserable users may impact the response time for all the users. This actually blocks a thread during the waiting time. This feature should **not** be used in a production environment since it can affect the availability of your website.
 ## Installation & configuration
 The following settings can be personnalized:
-* `MISERY_SLOW_STRENGTH`: seconds that miserable users will have to wait _at least_ (maximum twice longer) (default: 6)
+* `MISERY_SLOW_STRENGTH`: seconds that miserable users will have to wait _at least_ (maximum twice longer) (default: 0) **Important note**: deactivated by default, see cons #2 above.
 * `MISERY_LOGOUT_PROBABILITY`: **percentage** of probability a user will be disconnected (default: 10)
 * `MISERY_403_PROBABILITY`: same for 403 (default: 10)
 * `MISERY_404_PROBABILITY`: I'm gonna let you guess for this one (default: 10)

File django_misery/

 logger = logging.getLogger('django_misery')
-slowBanStrength = int(getattr(settings, 'MISERY_SLOW_STRENGTH', 6))
+slowBanStrength = int(getattr(settings, 'MISERY_SLOW_STRENGTH', 0))
 logoutProbability = int(getattr(settings, 'MISERY_LOGOUT_PROBABILITY', 10))
 e403Probability = int(getattr(settings, 'MISERY_403_PROBABILITY', 10))
 e404Probability = int(getattr(settings, 'MISERY_404_PROBABILITY', 10))