Apply hotfix to make mirrorlist thread
This commit is contained in:
parent
3c223dfce4
commit
0991339c42
2 changed files with 13 additions and 16 deletions
27
files/hotfix/mirrorlist/mirrorlist_server.py
Normal file → Executable file
27
files/hotfix/mirrorlist/mirrorlist_server.py
Normal file → Executable file
|
@ -16,7 +16,7 @@ import cPickle as pickle
|
|||
import select
|
||||
import signal
|
||||
import socket
|
||||
from SocketServer import (StreamRequestHandler, ForkingMixIn,
|
||||
from SocketServer import (StreamRequestHandler, ThreadingMixIn,
|
||||
UnixStreamServer, BaseServer)
|
||||
import sys
|
||||
from string import zfill, atoi
|
||||
|
@ -850,7 +850,6 @@ def errordoc(metalink, message):
|
|||
|
||||
class MirrorlistHandler(StreamRequestHandler):
|
||||
def handle(self):
|
||||
signal.signal(signal.SIGHUP, signal.SIG_IGN)
|
||||
random.seed()
|
||||
try:
|
||||
# read size of incoming pickle
|
||||
|
@ -916,16 +915,15 @@ def sighup_handler(signum, frame):
|
|||
logfile = open(name, 'a')
|
||||
|
||||
# put this in a separate thread so it doesn't block clients
|
||||
if threading.active_count() < 2:
|
||||
thread = threading.Thread(target=load_databases_and_caches)
|
||||
thread.daemon = False
|
||||
try:
|
||||
thread.start()
|
||||
except KeyError:
|
||||
# bug fix for handing an exception when unable to delete from
|
||||
#_limbo even though it's not in limbo
|
||||
# https://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/dist27/threading.py?r=327
|
||||
pass
|
||||
thread = threading.Thread(target=load_databases_and_caches)
|
||||
thread.daemon = False
|
||||
try:
|
||||
thread.start()
|
||||
except KeyError:
|
||||
# bug fix for handing an exception when unable to delete from
|
||||
#_limbo even though it's not in limbo
|
||||
# https://code.google.com/p/googleappengine/source/browse/trunk/python/google/appengine/dist27/threading.py?r=327
|
||||
pass
|
||||
|
||||
|
||||
def sigterm_handler(signum, frame):
|
||||
|
@ -936,11 +934,10 @@ def sigterm_handler(signum, frame):
|
|||
must_die = True
|
||||
|
||||
|
||||
class ForkingUnixStreamServer(ForkingMixIn, UnixStreamServer):
|
||||
class ThreadingUnixStreamServer(ThreadingMixIn, UnixStreamServer):
|
||||
request_queue_size = 300
|
||||
max_children = 80
|
||||
def finish_request(self, request, client_address):
|
||||
signal.signal(signal.SIGHUP, signal.SIG_IGN)
|
||||
BaseServer.finish_request(self, request, client_address)
|
||||
|
||||
|
||||
|
@ -1107,7 +1104,7 @@ def main():
|
|||
signal.signal(signal.SIGHUP, sighup_handler)
|
||||
# restart interrupted syscalls like select
|
||||
signal.siginterrupt(signal.SIGHUP, False)
|
||||
ss = ForkingUnixStreamServer(socketfile, MirrorlistHandler)
|
||||
ss = ThreadingUnixStreamServer(socketfile, MirrorlistHandler)
|
||||
|
||||
while not must_die:
|
||||
try:
|
||||
|
|
|
@ -75,7 +75,7 @@
|
|||
# - selinux
|
||||
|
||||
|
||||
- name: HOTFIX - increase the number of possible child processes
|
||||
- name: HOTFIX - increase the number of possible child processes and use threads
|
||||
copy: src="{{ files }}/hotfix/mirrorlist/mirrorlist_server.py" dest=/usr/share/mirrormanager2/mirrorlist_server.py
|
||||
owner=root group=root mode=0755
|
||||
tags:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue