Issue #760 resolved

Session tool cleanup frequency

Anonymous created an issue

The session tool cleanup frequency is to high. The documentation specifies that it shoud be given in minutes, but session.load() calls !PerpetualTimer (CherryPy 3.0.2) and cherrypy.restsrv.plugins.Monitor (CherryPy 3.1b1) without scaling the value

!PerpetualTimer is a subclass of threading.Timer which has the following documentation:

{{{ class Timer(interval, function, args=[], kwargs={})

Create a timer that will run function with arguments args and keyword arguments kwargs, after interval seconds have passed. }}}

Monitor in CherryPy 3.1b1 states itself that the timeout is in seconds.

Thus the default value of clean_freq=5 will call cleanup every 5 seconds instead of every 5 minutes. The correct code for CherryPy 3.0.2 should be:

{{{ t = PerpetualTimer(self.clean_freq*60, self.clean_up) }}}

And CherryPy 3.1b1:

{{{ t = cherrypy.restsrv.plugins.Monitor( cherrypy.engine, self.clean_up, self.clean_freq*60) }}}

One other option is to change documentation to say that the cleanup frequency is in seconds instead of minutes, giving developers the option of specifying a cleanup frequency lower than 1 minute.

-- Dag

Reported by dag@brattli.net

Comments (2)

  1. Log in to comment