Context:cherrypy session currently locks on request start and releases the lock when the request ends. Hence concurrent requests are processed serially and getting blocked.
Is it possible to extend a class, overwrite a few methods where the new methods call the parent method and then monkey patch the result?
Example:
from cherrypy.lib import sessions
class LockingSession(sessions.RamSession):
def get(self, *args, **kwargs):
# acquire lock
super(LockingSession).get(*args, **kwargs)
# release lock
sessions.RamSession = LockingSession
The example doesn't work - infinite loop :-)
Would this be the correct approach. Is this possible at all? If yes, how?