Catch ctrl+c to commit before quitting.
This commit is contained in:
parent
ad87a45db1
commit
52963e2fe6
1 changed files with 8 additions and 2 deletions
|
@ -261,7 +261,10 @@ def incremental_update(threads=1):
|
||||||
ids = [row[0] for row in cur.fetchall()]
|
ids = [row[0] for row in cur.fetchall()]
|
||||||
|
|
||||||
sticks = scrape_directs(ids, threads=threads)
|
sticks = scrape_directs(ids, threads=threads)
|
||||||
|
try:
|
||||||
insert_sticks(sticks)
|
insert_sticks(sticks)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
sql.commit()
|
||||||
|
|
||||||
def full_update(threads=1):
|
def full_update(threads=1):
|
||||||
for category in CATEGORIES:
|
for category in CATEGORIES:
|
||||||
|
@ -273,7 +276,10 @@ def full_update(threads=1):
|
||||||
ids = [row[0] for row in cur.fetchall()]
|
ids = [row[0] for row in cur.fetchall()]
|
||||||
|
|
||||||
sticks = scrape_directs(ids, threads=threads)
|
sticks = scrape_directs(ids, threads=threads)
|
||||||
|
try:
|
||||||
insert_sticks(sticks)
|
insert_sticks(sticks)
|
||||||
|
except KeyboardInterrupt:
|
||||||
|
sql.commit()
|
||||||
|
|
||||||
# DOWNLOAD
|
# DOWNLOAD
|
||||||
################################################################################
|
################################################################################
|
||||||
|
|
Loading…
Reference in a new issue