From f091b308bce81206f8e7afeabe748e5f33261fa8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Konstantin=20Gr=C3=BCndger?= Date: Thu, 25 Apr 2019 08:37:23 +0200 Subject: [PATCH] Bugfix for multiple device infos --- ogn_python/config/default.py | 29 ++++++++++++----------------- ogn_python/gateway/bulkimport.py | 4 ++-- setup.py | 20 +++++++++++--------- 3 files changed, 25 insertions(+), 28 deletions(-) diff --git a/ogn_python/config/default.py b/ogn_python/config/default.py index 0c1b974..8d82e7b 100644 --- a/ogn_python/config/default.py +++ b/ogn_python/config/default.py @@ -1,10 +1,10 @@ -SECRET_KEY = 'you-will-never-guess' +SECRET_KEY = 'i-like-ogn' -SQLALCHEMY_DATABASE_URI = 'postgresql://postgres@localhost:5432/ogn' +SQLALCHEMY_DATABASE_URI = 'postgresql://ogn:ognwriter@localhost:5432/ogn' SQLALCHEMY_TRACK_MODIFICATIONS = False # Flask-Cache stuff -CACHE_TYPE = 'simple' +CACHE_TYPE = 'redis' CACHE_DEFAULT_TIMEOUT = 300 # Celery stuff @@ -22,34 +22,29 @@ CELERYBEAT_SCHEDULE = { }, 'update-country-codes': { 'task': 'update_receivers_country_code', - 'schedule': timedelta(minutes=1), + 'schedule': timedelta(days=1), }, 'update-takeoff-and-landing': { 'task': 'update_takeoff_landings', - 'schedule': timedelta(minutes=1), - 'kwargs': {'last_minutes': 10}, + 'schedule': timedelta(hours=1), + 'kwargs': {'last_minutes': 90}, }, 'update-logbook': { 'task': 'update_logbook_entries', - 'schedule': timedelta(minutes=1), + 'schedule': timedelta(hours=2), }, 'update-max-altitudes': { 'task': 'update_logbook_max_altitude', 'schedule': timedelta(hours=1), }, - 'update-stats-hourly': { - 'task': 'update_stats', - 'schedule': timedelta(hours=1), - 'kwargs': {'day_offset': 0}, - }, 'update-stats-daily': { 'task': 'update_stats', 'schedule': crontab(hour=0, minute=5), 'kwargs': {'day_offset': -1}, }, - #'purge_old_data': { - # 'task': 'purge_old_data', - # 'schedule': timedelta(minutes=10), - # 'kwargs': {'max_hours': 48} - #}, + 'purge_old_data': { + 'task': 'purge_old_data', + 'schedule': timedelta(hours=1), + 'kwargs': {'max_hours': 48} + }, } diff --git a/ogn_python/gateway/bulkimport.py b/ogn_python/gateway/bulkimport.py index e36facb..e14426f 100644 --- a/ogn_python/gateway/bulkimport.py +++ b/ogn_python/gateway/bulkimport.py @@ -110,7 +110,7 @@ class ContinuousDbFeeder: app.logger.error("Ignore beacon_type: {}".format(message['beacon_type'])) return - if datetime.utcnow() - self.last_flush >= timedelta(seconds=5): + if datetime.utcnow() - self.last_flush >= timedelta(seconds=20): self.flush() self.prepare() @@ -123,7 +123,7 @@ class ContinuousDbFeeder: self.add_missing() self.last_add_missing = datetime.utcnow() - if datetime.utcnow() - self.last_transfer >= timedelta(seconds=10): + if datetime.utcnow() - self.last_transfer >= timedelta(seconds=30): self.transfer() self.delete_beacons() self.last_transfer = datetime.utcnow() diff --git a/setup.py b/setup.py index 3f38f80..e339e2c 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ with open(path.join(here, 'README.md'), encoding='utf-8') as f: setup( name='ogn-python', - version='0.4.0', + version='0.5.0', description='A database backend for the Open Glider Network', long_description=long_description, url='https://github.com/glidernet/ogn-python', @@ -34,21 +34,23 @@ setup( install_requires=[ 'Flask==1.0.2', 'flask-sqlalchemy==2.3.2', - 'Flask-Migrate==2.3.1', + 'Flask-Migrate==2.4.0', 'flask-bootstrap==3.3.7.1', 'flask-nav==0.6', 'flask-wtf==0.14.2', 'flask-caching==1.7.0', - 'geopy==1.17.0', - 'celery[redis]==4.2.1', - 'aerofiles==0.4.1', - 'geoalchemy2==0.5.0', - 'shapely>=1.5.17,<1.6', + 'geopy==1.19.0', + 'celery==4.3.0', + 'redis==3.2.1', + 'aerofiles==1.0.0', + 'geoalchemy2==0.4.0', + 'shapely==1.6.4.post2', 'ogn-client==0.9.1', - 'psycopg2-binary==2.7.6.1', + 'psycopg2-binary==2.8.1', 'mgrs==1.3.5', 'xmlunittest==0.5.0', - 'tqdm==4.28.1', + 'tqdm==4.31.1', + 'requests==2.21.0', ], extras_require={ 'dev': [