add stats as upsert in case of binlog not being sequential

This commit is contained in:
aldacron 2017-05-16 03:20:38 -07:00
parent 00c768c722
commit 40c34e7df0
1 changed files with 3 additions and 2 deletions

View File

@ -58,7 +58,8 @@ stream = BinLogStreamReader(
'host': MYSQL_HOST, 'host': MYSQL_HOST,
'port': MYSQL_PORT, 'port': MYSQL_PORT,
'user': MYSQL_USER, 'user': MYSQL_USER,
'passwd': MYSQL_PW 'passwd': MYSQL_PW,
}, },
server_id=10, # arbitrary server_id=10, # arbitrary
# only care about this database currently # only care about this database currently
@ -124,7 +125,7 @@ def reindex_stats(s, index_name):
"download_count": s["download_count"], "download_count": s["download_count"],
"leech_count": s['leech_count'], "leech_count": s['leech_count'],
"seed_count": s['seed_count'], "seed_count": s['seed_count'],
}}) }, "doc_as_upsert": True})
n = 0 n = 0
last_save = time.time() last_save = time.time()