Unverified Commit 0c308f17 authored by Michal 'vorner' Vaner's avatar Michal 'vorner' Vaner
Browse files

Do the CPU-intensive work in different thread pool

And leave the rest for DB
parent 472f7dc6
......@@ -21,6 +21,7 @@ from twisted.internet.task import LoopingCall
from twisted.internet import threads, reactor
from twisted.python.failure import Failure
import logging
import plugin
logger = logging.getLogger(name='buckets')
......@@ -53,7 +54,7 @@ def flush():
global __batch
if __batch:
logger.debug("Batch flush")
deferred = threads.deferToThreadPool(reactor, reactor.getThreadPool(), __execute, __batch)
deferred = threads.deferToThreadPool(reactor, plugin.pool, __execute, __batch)
__batch = []
......@@ -26,13 +26,13 @@ import log_extra
import logging
import logging.handlers
from client import ClientFactory
from plugin import Plugins
from plugin import Plugins, pool
import master_config
import activity
import importlib
import os
reactor.suggestThreadPoolSize(1) # Too much seems to have trouble with locking :-(
reactor.suggestThreadPoolSize(4) # Too much seems to have trouble with locking :-(
severity = master_config.get('log_severity')
if severity == 'TRACE':
severity = log_extra.TRACE_LEVEL
......@@ -91,6 +91,7 @@ logging.info('Init done')
logging.info('Finishing up')
if socat:
soc = socat
socat = None
......@@ -18,11 +18,16 @@
from protocol import format_string
from twisted.python.threadpool import ThreadPool
import logging
import time
logger = logging.getLogger(name='plugin')
pool = ThreadPool()
class Plugin:
Base class of a plugin. Use this when writing new plugins. Provides
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment