quick fixes

master
alice 4 years ago
parent 25358d3a18
commit 91490a7d62

@ -4,6 +4,7 @@ import os
from celery import Celery from celery import Celery
from celery.schedules import crontab from celery.schedules import crontab
from datetime import timedelta
# set the default Django settings module for the 'celery' program. # set the default Django settings module for the 'celery' program.
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ccvpn.settings') os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'ccvpn.settings')
@ -19,19 +20,19 @@ app.config_from_object('django.conf:settings', namespace='CELERY')
app.conf.beat_schedule = { app.conf.beat_schedule = {
'payments__check_subscriptions': { 'payments__check_subscriptions': {
'task': 'payments.tasks.check_subscriptions', 'task': 'payments.tasks.check_subscriptions',
'schedule': crontab(hour=1), 'schedule': timedelta(hours=24),
}, },
'payments__cancel_old_payments': { 'payments__cancel_old_payments': {
'task': 'payments.tasks.cancel_old_payments', 'task': 'payments.tasks.cancel_old_payments',
'schedule': crontab(hour=2), 'schedule': timedelta(hours=24),
}, },
'lambdainst__resync': { 'lambdainst__resync': {
'task': 'lambdainst.tasks.push_all_users', 'task': 'lambdainst.tasks.push_all_users',
'schedule': crontab(day_of_week=1), 'schedule': timedelta(days=7),
}, },
'lambdainst__notify_account_expiration': { 'lambdainst__notify_account_expiration': {
'task': 'lambdainst.tasks.notify_account_expiration', 'task': 'lambdainst.tasks.notify_account_expiration',
'schedule': crontab(hour='*/6'), 'schedule': timedelta(hours=6),
}, },
} }

@ -284,7 +284,7 @@ def make_export_zip(user, name):
with z.open(name + "/wireguard_peers.json", "w") as jf: with z.open(name + "/wireguard_peers.json", "w") as jf:
try: try:
keys = map(process_wg_peer, django_lcore.api.get_wg_peers(user.username)) keys = list(map(process_wg_peer, django_lcore.api.get_wg_peers(user.username)))
except lcoreapi.APINotFoundError: except lcoreapi.APINotFoundError:
keys = [] keys = []
jf.write(json.dumps(keys, indent=2).encode('ascii')) jf.write(json.dumps(keys, indent=2).encode('ascii'))

Loading…
Cancel
Save