1
0
Fork 0
mirror of https://gitlab.com/SIGBUS/nyaa.git synced 2024-12-21 17:49:59 +00:00

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

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()