mirror of
https://github.com/minetest/contentdb.git
synced 2025-01-03 19:57:29 +01:00
Add celery beat for topic import
This commit is contained in:
parent
328d05bdf6
commit
75bab28d82
1
.gitignore
vendored
1
.gitignore
vendored
@ -7,6 +7,7 @@ log.txt
|
||||
*.rdb
|
||||
uploads
|
||||
thumbnails
|
||||
celerybeat-schedule
|
||||
|
||||
# Created by https://www.gitignore.io/api/linux,macos,python,windows
|
||||
|
||||
|
@ -18,6 +18,7 @@
|
||||
import flask
|
||||
from flask.ext.sqlalchemy import SQLAlchemy
|
||||
from celery import Celery
|
||||
from celery.schedules import crontab
|
||||
from app import app
|
||||
from app.models import *
|
||||
|
||||
@ -64,4 +65,12 @@ def make_celery(app):
|
||||
|
||||
celery = make_celery(app)
|
||||
|
||||
CELERYBEAT_SCHEDULE = {
|
||||
'topic_list_import': {
|
||||
'task': 'app.tasks.forumtasks.importTopicList',
|
||||
'schedule': crontab(minute=1, hour=1),
|
||||
}
|
||||
}
|
||||
celery.conf.beat_schedule = CELERYBEAT_SCHEDULE
|
||||
|
||||
from . import importtasks, forumtasks, emails
|
||||
|
@ -138,4 +138,7 @@ def importTopicList():
|
||||
topic.views = info["views"]
|
||||
topic.created_at = info["date"]
|
||||
|
||||
for p in Package.query.all():
|
||||
p.recalcScore()
|
||||
|
||||
db.session.commit()
|
||||
|
Loading…
Reference in New Issue
Block a user