mirror of
https://github.com/simon987/od-database.git
synced 2025-04-10 14:06:45 +00:00
hotfix attempt 2
This commit is contained in:
parent
8ced4859f3
commit
0ff6ea1682
4
api.py
4
api.py
@ -34,9 +34,7 @@ def setup_api(app):
|
||||
website_id = oddb.db.get_oldest_website_id()
|
||||
website = oddb.db.get_website_by_id(website_id)
|
||||
task = Task(website_id, website.url)
|
||||
oddb.db.put_task(task)
|
||||
|
||||
task = oddb.db.pop_task(name, accept_ftp)
|
||||
oddb.db.put_task(task, name)
|
||||
except:
|
||||
oddb.logger.error("Couldn't create new task")
|
||||
abort(404)
|
||||
|
@ -373,15 +373,15 @@ class Database:
|
||||
|
||||
conn.commit()
|
||||
|
||||
def put_task(self, task: Task) -> None:
|
||||
def put_task(self, task: Task, assigned_crawler=None) -> None:
|
||||
|
||||
with sqlite3.connect(self.db_path) as conn:
|
||||
cursor = conn.cursor()
|
||||
|
||||
cursor.execute("INSERT INTO Queue (website_id, url, priority, callback_type, callback_args) "
|
||||
"VALUES (?,?,?,?,?)",
|
||||
cursor.execute("INSERT INTO Queue (website_id, url, priority, callback_type, callback_args, assigned_crawler) "
|
||||
"VALUES (?,?,?,?,?,?)",
|
||||
(task.website_id, task.url, task.priority,
|
||||
task.callback_type, json.dumps(task.callback_args)))
|
||||
task.callback_type, json.dumps(task.callback_args), assigned_crawler))
|
||||
conn.commit()
|
||||
|
||||
def get_tasks(self) -> list:
|
||||
|
Loading…
x
Reference in New Issue
Block a user