From 7ad68d9c2b7790e4c1ae0066d2b2a54f88676cf7 Mon Sep 17 00:00:00 2001 From: kanoi Date: Sat, 6 Sep 2014 21:37:39 +1000 Subject: [PATCH] ckdb - speed up reload - only one DB write per sharesummary --- src/ckdb.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/ckdb.c b/src/ckdb.c index c732b13e..6c3f95ca 100644 --- a/src/ckdb.c +++ b/src/ckdb.c @@ -4866,6 +4866,10 @@ static bool _sharesummary_update(PGconn *conn, SHARES *s_row, SHAREERRORS *e_row } } + // During startup, don't save 'new' sharesummaries, to reduce DB I/O + if (!startup_complete && row->complete[0] == SUMMARY_NEW) + goto startupskip; + if (conn == NULL && !confirm_sharesummary) { conn = dbconnect(); conned = true; @@ -4875,6 +4879,7 @@ static bool _sharesummary_update(PGconn *conn, SHARES *s_row, SHAREERRORS *e_row MODIFYDATEINIT(row, cd, by, code, inet); par = 0; + if (!confirm_sharesummary) { params[par++] = bigint_to_buf(row->userid, NULL, 0); params[par++] = str_to_buf(row->workername, NULL, 0); @@ -5003,7 +5008,7 @@ static bool _sharesummary_update(PGconn *conn, SHARES *s_row, SHAREERRORS *e_row } } } - +startupskip: ok = true; unparam: if (par) {