mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-24 07:21:08 +00:00
fix linter issues
This commit is contained in:
parent
cd43aae535
commit
6f03e2ad4c
|
@ -2,10 +2,7 @@ from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
import multiprocessing
|
import multiprocessing
|
||||||
import os
|
|
||||||
import signal
|
import signal
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import time
|
import time
|
||||||
import traceback
|
import traceback
|
||||||
import typing
|
import typing
|
||||||
|
@ -127,10 +124,15 @@ class Application(web.Application):
|
||||||
if self["running"]:
|
if self["running"]:
|
||||||
return
|
return
|
||||||
|
|
||||||
if not check_open_port(self.config.listen, self.config.port):
|
domain = self.config.domain
|
||||||
return logging.error(f'A server is already running on port {self.config.port}')
|
host = self.config.listen
|
||||||
|
port = self.config.port
|
||||||
|
|
||||||
logging.info(f'Starting webserver at {self.config.domain} ({self.config.listen}:{self.config.port})')
|
if not check_open_port(host, port):
|
||||||
|
logging.error(f'A server is already running on {host}:{port}')
|
||||||
|
return
|
||||||
|
|
||||||
|
logging.info(f'Starting webserver at {domain} ({host}:{port})')
|
||||||
asyncio.run(self.handle_run())
|
asyncio.run(self.handle_run())
|
||||||
|
|
||||||
|
|
||||||
|
@ -158,7 +160,7 @@ class Application(web.Application):
|
||||||
self['cleanup_thread'] = CacheCleanupThread(self)
|
self['cleanup_thread'] = CacheCleanupThread(self)
|
||||||
self['cleanup_thread'].start()
|
self['cleanup_thread'].start()
|
||||||
|
|
||||||
for i in range(self.config.workers):
|
for _ in range(self.config.workers):
|
||||||
worker = PushWorker(self['push_queue'])
|
worker = PushWorker(self['push_queue'])
|
||||||
worker.start()
|
worker.start()
|
||||||
|
|
||||||
|
@ -181,7 +183,7 @@ class Application(web.Application):
|
||||||
|
|
||||||
await site.stop()
|
await site.stop()
|
||||||
|
|
||||||
for worker in self['workers']:
|
for worker in self['workers']: # pylint: disable=not-an-iterable
|
||||||
worker.stop()
|
worker.stop()
|
||||||
|
|
||||||
self.set_signal_handler(False)
|
self.set_signal_handler(False)
|
||||||
|
|
|
@ -18,7 +18,7 @@ from .config import (
|
||||||
)
|
)
|
||||||
|
|
||||||
from .. import logger as logging
|
from .. import logger as logging
|
||||||
from ..misc import get_app
|
from ..misc import boolean, get_app
|
||||||
|
|
||||||
if typing.TYPE_CHECKING:
|
if typing.TYPE_CHECKING:
|
||||||
from collections.abc import Iterator
|
from collections.abc import Iterator
|
||||||
|
|
|
@ -5,8 +5,6 @@ import asyncio
|
||||||
import click
|
import click
|
||||||
import os
|
import os
|
||||||
import platform
|
import platform
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
from aputils.signer import Signer
|
from aputils.signer import Signer
|
||||||
|
|
|
@ -88,11 +88,11 @@ def get_resource(path: str) -> Path:
|
||||||
|
|
||||||
|
|
||||||
class JsonEncoder(json.JSONEncoder):
|
class JsonEncoder(json.JSONEncoder):
|
||||||
def default(self, obj: Any) -> str:
|
def default(self, o: Any) -> str:
|
||||||
if isinstance(obj, datetime):
|
if isinstance(o, datetime):
|
||||||
return obj.isoformat()
|
return o.isoformat()
|
||||||
|
|
||||||
return JSONEncoder.default(self, obj)
|
return json.JSONEncoder.default(self, o)
|
||||||
|
|
||||||
|
|
||||||
class Message(ApMessage):
|
class Message(ApMessage):
|
||||||
|
|
|
@ -5,8 +5,6 @@ import typing
|
||||||
from hamlish_jinja.extension import HamlishExtension
|
from hamlish_jinja.extension import HamlishExtension
|
||||||
from jinja2 import Environment, FileSystemLoader
|
from jinja2 import Environment, FileSystemLoader
|
||||||
|
|
||||||
from pathlib import Path
|
|
||||||
|
|
||||||
from .database.config import THEMES
|
from .database.config import THEMES
|
||||||
from .misc import get_resource
|
from .misc import get_resource
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,6 @@ import typing
|
||||||
|
|
||||||
from aiohttp import web
|
from aiohttp import web
|
||||||
from argon2.exceptions import VerifyMismatchError
|
from argon2.exceptions import VerifyMismatchError
|
||||||
from datetime import datetime, timezone
|
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
|
|
||||||
from .base import View, register_route
|
from .base import View, register_route
|
||||||
|
|
Loading…
Reference in a new issue