diff options
-rw-r--r-- | pyaggr3g470r/decorators.py | 3 | ||||
-rw-r--r-- | pyaggr3g470r/search.py | 4 | ||||
-rw-r--r-- | pyaggr3g470r/views.py | 3 |
3 files changed, 4 insertions, 6 deletions
diff --git a/pyaggr3g470r/decorators.py b/pyaggr3g470r/decorators.py index 5cacb09f..3e808793 100644 --- a/pyaggr3g470r/decorators.py +++ b/pyaggr3g470r/decorators.py @@ -11,7 +11,8 @@ from pyaggr3g470r.models import Feed def async(f): """ - This decorator enables to send email in a new thread. + This decorator enables to launch a task (for examle sending an email or + indexing the database) in background. This prevent the server to freeze. """ def wrapper(*args, **kwargs): diff --git a/pyaggr3g470r/search.py b/pyaggr3g470r/search.py index b9e0ade7..2c065fb3 100644 --- a/pyaggr3g470r/search.py +++ b/pyaggr3g470r/search.py @@ -62,10 +62,8 @@ def create_index(user_id): os.makedirs(indexdir) ix = create_in(indexdir, schema) writer = ix.writer() - logger.info("Starting now.") - logger.info("Test: "+ user.nickname) for feed in user.feeds: - logger.info("Indexing " +feed.title) + logger.info("Indexing " + feed.title) for article in feed.articles: writer.add_document(title=article.title, content=utils.clear_string(article.content), diff --git a/pyaggr3g470r/views.py b/pyaggr3g470r/views.py index bec9f5ba..12f73791 100644 --- a/pyaggr3g470r/views.py +++ b/pyaggr3g470r/views.py @@ -494,9 +494,8 @@ def index_database(): Index all the database. """ if not conf.ON_HEROKU: - user = User.query.filter(User.id == g.user.id).first() try: - fastsearch.create_index(user.id) + fastsearch.create_index(g.user.id) flash(gettext('Indexing database...'), 'success') except Exception as e: flash(gettext('An error occured') + ' (%s).' % e, 'danger') |