mirror of
https://github.com/simon987/od-database.git
synced 2025-04-04 06:52:59 +00:00
More bug fixes...
This commit is contained in:
parent
ae0fb9b1a6
commit
e8f0f96148
7
app.py
7
app.py
@ -18,8 +18,11 @@ api.setup_api(app)
|
||||
if os.environ.get("ODDB_USER", False) and os.environ.get("ODDB_PASSWORD", False):
|
||||
user = os.environ["ODDB_USER"]
|
||||
password = os.environ["ODDB_PASSWORD"]
|
||||
common.db.generate_login(user, password)
|
||||
print("Generated user %s" % user)
|
||||
try:
|
||||
common.db.generate_login(user, password)
|
||||
print("Generated user %s" % user)
|
||||
except:
|
||||
pass
|
||||
|
||||
if __name__ == '__main__':
|
||||
app.run("0.0.0.0", port=80, threaded=True)
|
||||
|
@ -16,7 +16,7 @@ TT_CRAWL_PROJECT = int(environ.get("TT_CRAWL_PROJECT", 3))
|
||||
TT_INDEX_PROJECT = int(environ.get("TT_INDEX_PROJECT", 9))
|
||||
|
||||
WSB_API = environ.get("WSB_API", "http://localhost:3020")
|
||||
WSB_SECRET = environ.get("WSB_API", "default_secret")
|
||||
WSB_SECRET = environ.get("WSB_SECRET", "default_secret")
|
||||
|
||||
ES_URL = environ.get("ES_URL", "http://localhost:9200")
|
||||
ES_INDEX = environ.get("ES_INDEX", "od-database")
|
||||
|
@ -121,8 +121,9 @@ class Database:
|
||||
cursor = conn.cursor()
|
||||
cursor.execute("SELECT id FROM Website ORDER BY random() LIMIT 1")
|
||||
|
||||
if cursor.fetchone():
|
||||
return cursor.fetchone()[0]
|
||||
row = cursor.fetchone()
|
||||
if row:
|
||||
return row[0]
|
||||
return None
|
||||
|
||||
def website_exists(self, url):
|
||||
|
4
tasks.py
4
tasks.py
@ -11,7 +11,6 @@ from uuid import uuid4
|
||||
import requests
|
||||
import urllib3
|
||||
|
||||
import common
|
||||
import config
|
||||
import database
|
||||
from database import Website
|
||||
@ -75,13 +74,12 @@ class TaskManager:
|
||||
if not self.worker:
|
||||
self.worker = self.tracker.make_worker("$oddb_master")
|
||||
if not self.worker:
|
||||
common.logger.error("Could not create worker: %s" % traceback.format_exc())
|
||||
print("Could not create worker: %s" % traceback.format_exc())
|
||||
return
|
||||
self.worker.dump_to_file()
|
||||
self.worker.request_access(config.TT_CRAWL_PROJECT, False, True)
|
||||
self.worker.request_access(config.TT_INDEX_PROJECT, True, False)
|
||||
|
||||
|
||||
def start_indexer_threads(self):
|
||||
logger.info("Starting %s indexer threads " % (config.INDEXER_THREADS, ))
|
||||
for _ in range(config.INDEXER_THREADS):
|
||||
|
Loading…
x
Reference in New Issue
Block a user