Skip to content

Commit

Permalink
Gunicorn with 4 workers (#295)
Browse files Browse the repository at this point in the history
* change missing country code to debug level

* set gunicorn config to 4 workers

* log worker id
  • Loading branch information
Kilo59 committed Apr 19, 2020
1 parent 5a605ec commit 05e67bd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Procfile
Original file line number Diff line number Diff line change
@@ -1 +1 @@
web: gunicorn app.main:APP -k uvicorn.workers.UvicornWorker
web: gunicorn app.main:APP -w 4 -k uvicorn.workers.UvicornWorker
3 changes: 2 additions & 1 deletion app/services/location/jhu.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
"""app.services.location.jhu.py"""
import csv
import logging
import os
from datetime import datetime

from asyncache import cached
Expand Down Expand Up @@ -57,7 +58,7 @@ async def get_category(category):
url = BASE_URL + "time_series_covid19_%s_global.csv" % category

# Request the data
LOGGER.info("jhu Requesting data...")
LOGGER.info(f"pid:{os.getpid()}: jhu Requesting data...")
async with httputils.CLIENT_SESSION.get(url) as response:
text = await response.text()

Expand Down
2 changes: 1 addition & 1 deletion app/utils/countries.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,6 @@ def country_code(value):
"""
code = COUNTRY_NAME__COUNTRY_CODE.get(value, DEFAULT_COUNTRY_CODE)
if code == DEFAULT_COUNTRY_CODE:
LOGGER.info(f"No country code found for '{value}'. Using '{code}'!")
LOGGER.debug(f"No country code found for '{value}'. Using '{code}'!")

return code

0 comments on commit 05e67bd

Please sign in to comment.