Browse Source

remove uvloop

start zkill socket before redis to make them both happy
pull/4/head
Chainsaw McGinny 3 years ago
parent
commit
a4482e3e07
  1. 14
      bot.py
  2. 8
      launcher.py
  3. 3
      requirements.txt

14
bot.py

@ -52,14 +52,15 @@ class Rooster(commands.Bot):
help_command=commands.DefaultHelpCommand(dm_help=True),
help_attrs=dict(hidden=True),
)
self.kill_queue = Queue()
self.zk = zKillSocket(self.kill_queue)
self.zk.start()
self.redis = None
self.loop.run_until_complete(self.start_redis())
self.redis = self.loop.run_until_complete(aioredis.create_pool(("localhost", 6379), minsize=5, maxsize=10))
print('redis pool started', self.redis)
self.client_id = config.client_id
self.session = aiohttp.ClientSession(loop=self.loop)
self.esi = ESI()
self.kill_queue = Queue()
self.zk = zKillSocket(self.kill_queue)
self.zk.start()
for cog in initial_cogs:
try:
@ -68,11 +69,6 @@ class Rooster(commands.Bot):
print(f"Failed to load cog {cog}", file=sys.stderr)
traceback.print_exc()
async def start_redis(self):
self.redis = await aioredis.create_pool(
("localhost", 6379), minsize=5, maxsize=10, loop=self.loop
)
async def on_comand_error(self, ctx, error):
if isinstance(error, commands.NoPrivateMessage):
await ctx.author.send("This command cannot be used in Private Messages")

8
launcher.py

@ -6,14 +6,6 @@ import click
from bot import Rooster
try:
import uvloop
except ImportError:
pass
else:
asyncio.set_event_loop_policy(uvloop.EventLoopPolicy())
@contextlib.contextmanager
def setup_logging():
try:

3
requirements.txt

@ -6,10 +6,8 @@ esipy
EsiPysi
darkskylib
fuzzywuzzy
aiohttp
wheel
diskcache
uvloop; sys_platform=='linux' #uvloop not supported on windows
redis
aioredis>=1.0.0b2
backoff-async
@ -18,4 +16,3 @@ python-levenshtein
logbook
sqlalchemy
pyyaml
websockets
Loading…
Cancel
Save