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