mirror of
https://github.com/minetest/contentdb.git
synced 2024-11-09 17:13:45 +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
|
*.rdb
|
||||||
uploads
|
uploads
|
||||||
thumbnails
|
thumbnails
|
||||||
|
celerybeat-schedule
|
||||||
|
|
||||||
# Created by https://www.gitignore.io/api/linux,macos,python,windows
|
# Created by https://www.gitignore.io/api/linux,macos,python,windows
|
||||||
|
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
import flask
|
import flask
|
||||||
from flask.ext.sqlalchemy import SQLAlchemy
|
from flask.ext.sqlalchemy import SQLAlchemy
|
||||||
from celery import Celery
|
from celery import Celery
|
||||||
|
from celery.schedules import crontab
|
||||||
from app import app
|
from app import app
|
||||||
from app.models import *
|
from app.models import *
|
||||||
|
|
||||||
@ -64,4 +65,12 @@ def make_celery(app):
|
|||||||
|
|
||||||
celery = 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
|
from . import importtasks, forumtasks, emails
|
||||||
|
@ -138,4 +138,7 @@ def importTopicList():
|
|||||||
topic.views = info["views"]
|
topic.views = info["views"]
|
||||||
topic.created_at = info["date"]
|
topic.created_at = info["date"]
|
||||||
|
|
||||||
|
for p in Package.query.all():
|
||||||
|
p.recalcScore()
|
||||||
|
|
||||||
db.session.commit()
|
db.session.commit()
|
||||||
|
Loading…
Reference in New Issue
Block a user