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
10
droidz.py
10
droidz.py
|
@ -261,7 +261,10 @@ def incremental_update(threads=1):
|
|||
ids = [row[0] for row in cur.fetchall()]
|
||||
|
||||
sticks = scrape_directs(ids, threads=threads)
|
||||
insert_sticks(sticks)
|
||||
try:
|
||||
insert_sticks(sticks)
|
||||
except KeyboardInterrupt:
|
||||
sql.commit()
|
||||
|
||||
def full_update(threads=1):
|
||||
for category in CATEGORIES:
|
||||
|
@ -273,7 +276,10 @@ def full_update(threads=1):
|
|||
ids = [row[0] for row in cur.fetchall()]
|
||||
|
||||
sticks = scrape_directs(ids, threads=threads)
|
||||
insert_sticks(sticks)
|
||||
try:
|
||||
insert_sticks(sticks)
|
||||
except KeyboardInterrupt:
|
||||
sql.commit()
|
||||
|
||||
# DOWNLOAD
|
||||
################################################################################
|
||||
|
|
Loading…
Reference in a new issue