.BANCHO. Switched to tornado+gevent
This commit is contained in:
parent
0e74e5c1ce
commit
095f9b3bc9
|
@ -10,13 +10,14 @@ This is Ripple's bancho server. It handles:
|
|||
## Requirements
|
||||
- Python 3.5
|
||||
- MySQLdb (`mysqlclient` or `mysql-python`)
|
||||
- Tornado (`tornado`)
|
||||
- Bcrypt (`bcrypt`)
|
||||
- Tornado
|
||||
- Gevent
|
||||
- Bcrypt
|
||||
|
||||
## How to set up pep.py
|
||||
First of all, install all the dependencies
|
||||
```
|
||||
$ pip install mysqlclient tornado bcrypt
|
||||
$ pip install mysqlclient tornado gevent bcrypt
|
||||
```
|
||||
then, run pep.py once to create the default config file and edit it
|
||||
```
|
||||
|
|
|
@ -586,7 +586,6 @@ def tillerinoLast(fro, chan, message):
|
|||
stars = oppaiData["stars"]
|
||||
|
||||
msg += " | {0:.2f} stars".format(stars)
|
||||
|
||||
return msg
|
||||
except Exception as a:
|
||||
log.error(a)
|
||||
|
|
|
@ -49,7 +49,6 @@ class config:
|
|||
self.config.get("db","workers")
|
||||
|
||||
self.config.get("server","port")
|
||||
self.config.get("server","threads")
|
||||
self.config.get("server","gzip")
|
||||
self.config.get("server","gziplevel")
|
||||
self.config.get("server","cikey")
|
||||
|
@ -94,7 +93,6 @@ class config:
|
|||
|
||||
self.config.add_section("server")
|
||||
self.config.set("server", "port", "5001")
|
||||
self.config.set("server", "threads", "16")
|
||||
self.config.set("server", "gzip", "1")
|
||||
self.config.set("server", "gziplevel", "6")
|
||||
self.config.set("server", "cikey", "changeme")
|
||||
|
|
|
@ -5,6 +5,7 @@ from tornado.ioloop import IOLoop
|
|||
from objects import glob
|
||||
from raven.contrib.tornado import SentryMixin
|
||||
from raven.contrib.tornado import AsyncSentryClient
|
||||
import gevent
|
||||
|
||||
class asyncRequestHandler(tornado.web.RequestHandler):
|
||||
"""
|
||||
|
@ -58,8 +59,10 @@ def runBackground(data, callback):
|
|||
func, args, kwargs = data
|
||||
def _callback(result):
|
||||
IOLoop.instance().add_callback(lambda: callback(result))
|
||||
glob.pool.apply_async(func, args, kwargs, _callback)
|
||||
|
||||
#glob.pool.apply_async(func, args, kwargs, _callback)
|
||||
g = gevent.Greenlet(func, *args, **kwargs)
|
||||
g.link(_callback)
|
||||
g.start()
|
||||
|
||||
def checkArguments(arguments, requiredArguments):
|
||||
"""
|
||||
|
|
|
@ -20,7 +20,6 @@ tokens = tokenList.tokenList()
|
|||
channels = channelList.channelList()
|
||||
matches = matchList.matchList()
|
||||
restarting = False
|
||||
pool = None
|
||||
fLocks = fileLocks.fileLocks()
|
||||
verifiedCache = {}
|
||||
cloudflare = False
|
||||
|
|
12
pep.py
12
pep.py
|
@ -1,7 +1,6 @@
|
|||
"""Hello, pep.py here, ex-owner of ripple and prime minister of Ripwot."""
|
||||
import sys
|
||||
import os
|
||||
from multiprocessing.pool import ThreadPool
|
||||
import threading
|
||||
|
||||
# Tornado
|
||||
|
@ -9,6 +8,8 @@ import tornado.ioloop
|
|||
import tornado.web
|
||||
import tornado.httpserver
|
||||
import tornado.gen
|
||||
from gevent import monkey as brit_monkey
|
||||
brit_monkey.patch_all()
|
||||
|
||||
# Raven
|
||||
from raven.contrib.tornado import AsyncSentryClient
|
||||
|
@ -98,15 +99,6 @@ if __name__ == "__main__":
|
|||
glob.tokens.deleteBanchoSessions()
|
||||
consoleHelper.printDone()
|
||||
|
||||
# Create threads pool
|
||||
try:
|
||||
consoleHelper.printNoNl("> Creating threads pool... ")
|
||||
glob.pool = ThreadPool(int(glob.conf.config["server"]["threads"]))
|
||||
consoleHelper.printDone()
|
||||
except:
|
||||
consoleHelper.printError()
|
||||
consoleHelper.printColored("[!] Error while creating threads pool. Please check your config.ini and run the server again", bcolors.RED)
|
||||
|
||||
try:
|
||||
consoleHelper.printNoNl("> Loading chat filters... ")
|
||||
glob.chatFilters = chatFilters.chatFilters()
|
||||
|
|
Loading…
Reference in New Issue
Block a user