コード例 #1
0
ファイル: __init__.py プロジェクト: vagmits/porcupine
 def _expire_sessions(self):
     while self._is_active:
         try:
             self._remove_inactive_sessions()
         except Exception as e:
             logger.error('Error in session expiration thread: %s' % e)
         time.sleep(3.0)
コード例 #2
0
ファイル: __init__.py プロジェクト: vagmits/porcupine
 def _expire_sessions(self):
     while self._is_active:
         try:
             self._remove_inactive_sessions()
         except Exception as e:
             logger.error('Error in session expiration thread: %s' % e)
         time.sleep(3.0)
コード例 #3
0
    def handle_request(self, rh):
        request = MgtMessage()
        request.load(rh.input_buffer)
        cmd = request.header

        try:
            args = self.execute_command(cmd, request)
            if args:
                response = MgtMessage(*args)
                # send the response
                rh.write_buffer(response.serialize())
        except:
            logger.error('Management Error:', *(), **{'exc_info': 1})
            error_msg = MgtMessage(-1,
                'Internal server error. See server log for details.')
            rh.write_buffer(error_msg.serialize())
コード例 #4
0
ファイル: management.py プロジェクト: vagmits/porcupine
    def handle_request(self, rh):
        request = MgtMessage()
        request.load(rh.input_buffer)
        cmd = request.header

        try:
            args = self.execute_command(cmd, request)
            if args:
                response = MgtMessage(*args)
                # send the response
                rh.write_buffer(response.serialize())
        except:
            logger.error('Management Error:', *(), **{'exc_info': 1})
            error_msg = MgtMessage(-1,
                'Internal server error. See server log for details.')
            rh.write_buffer(error_msg.serialize())
コード例 #5
0
 def _expire_sessions(self):
     from porcupine.core.runtime import logger
     while self._is_active:
         try:
             # get inactive sessions
             cursor = db._db.join((
                 ('_parentid', '_sessions'),
                 ('modified', (None, time.time() - self.timeout))), None)
             cursor.fetch_all = True
             sessions = [session for session in cursor]
             cursor.close()
             for session in sessions:
                 logger.debug('Expiring Session: %s' % session.id)
                 session.terminate()
         except Exception, e:
             logger.error('Error in session expiration thread: %s' % e)
         time.sleep(3.0)