Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,13 @@ jobs:
options: --entrypoint redis-server

env:
DATABASE_URL: 'postgres://postgres:[email protected]:5432/socket_test'
DATABASE_URL: 'postgresql://postgres:[email protected]:5432/socket_test'

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: set up python
uses: actions/setup-python@v1
uses: actions/setup-python@v4
with:
python-version: '3.8'

Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:
HEROKU_APP: tc-socket

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- run: git fetch --unshallow
- run: git switch master
- run: git remote add heroku https://heroku:[email protected]/$HEROKU_APP.git
Expand Down
2 changes: 1 addition & 1 deletion tcsocket/app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ def setup_routes(app):
app.router.add_post(r'/{company}/book-appointment', book_appointment, name='book-appointment')


def create_app(loop, *, settings: Settings = None):
def create_app(*, settings: Settings = None):
app = web.Application(middlewares=middleware)
settings = settings or Settings()
app['settings'] = settings
Expand Down
2 changes: 1 addition & 1 deletion tcsocket/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SQLAlchemy==1.4.40
sqlalchemy==1.4.38
aiodns==3.0.0
aiohttp==3.8.1
aiopg==1.3.4
Expand Down
14 changes: 8 additions & 6 deletions tcsocket/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,16 @@ def cli(verbose):
setup_logging(verbose)


async def start_and_stop_app(app):
await app.startup()
await app.cleanup()


def check_app():
loop = asyncio.get_event_loop()
logger.info("initialising aiohttp app to check it's working...")
app = create_app(loop)
app = create_app()
app.freeze()
loop.run_until_complete(app.startup())
loop.run_until_complete(app.cleanup())
asyncio.run(start_and_stop_app(app))
del app
logger.info('app started and stopped successfully, apparently configured correctly')

Expand Down Expand Up @@ -62,8 +65,7 @@ def load_config(self):
self.cfg.set(k, v)

def load(self):
loop = asyncio.get_event_loop()
return create_app(loop)
return create_app()

logger.info('starting gunicorn...')
Application().run()
Expand Down
2 changes: 1 addition & 1 deletion tests/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ pycodestyle==2.9.1
pyflakes==2.5.0
pytest==7.1.2
pytest-aiohttp==1.0.4
pytest-asyncio==0.18.3
pytest-asyncio==0.21.0
pytest-cov==3.0.0
pytest-isort==3.0.0
pytest-mock==3.8.2
Expand Down