1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-22 04:10:00 +00:00

config: Add Elasticsearch hosts

This commit is contained in:
TheAMM 2018-05-16 19:53:09 +03:00
parent b999f8d39f
commit 98a89265c0
4 changed files with 9 additions and 3 deletions

View file

@ -144,6 +144,8 @@ ENABLE_ELASTIC_SEARCH_HIGHLIGHT = False
ES_MAX_SEARCH_RESULT = 1000
# ES index name generally (nyaa or sukebei)
ES_INDEX_NAME = SITE_FLAVOR
# ES hosts
ES_HOSTS = ['localhost:9200']
################
## Commenting ##

View file

@ -18,7 +18,7 @@ from nyaa import create_app, models
from nyaa.extensions import db
app = create_app('config')
es = Elasticsearch(timeout=30)
es = Elasticsearch(hosts=app.config['ES_HOSTS'], timeout=30)
ic = IndicesClient(es)
def pad_bytes(in_bytes, size):

View file

@ -185,7 +185,7 @@ def search_elastic(term='', user=None, sort='id', order='desc',
if page > 4294967295:
flask.abort(404)
es_client = Elasticsearch()
es_client = Elasticsearch(hosts=app.config['ES_HOSTS'])
es_sort_keys = {
'id': 'id',

View file

@ -34,7 +34,11 @@ from elasticsearch.helpers import bulk, BulkIndexError
from pymysqlreplication import BinLogStreamReader
from pymysqlreplication.row_event import UpdateRowsEvent, DeleteRowsEvent, WriteRowsEvent
from datetime import datetime
from nyaa import create_app, db, models
from nyaa.models import TorrentFlags
app = create_app('config')
import sys
import json
import time
@ -262,7 +266,7 @@ class EsPoster(ExitingThread):
self.flush_interval = flush_interval
def run_happy(self):
es = Elasticsearch(timeout=30)
es = Elasticsearch(hosts=app.config['ES_HOSTS'], timeout=30)
last_save = time.time()
since_last = 0