Browse Source

ckdb - add optioncontrol override for blocklist rows

master
kanoi 9 years ago
parent
commit
543c5e7082
  1. 7
      src/ckdb.h
  2. 8
      src/ckdb_cmd.c

7
src/ckdb.h

@ -55,7 +55,7 @@
#define DB_VLOCK "1"
#define DB_VERSION "1.0.2"
#define CKDB_VERSION DB_VERSION"-1.224"
#define CKDB_VERSION DB_VERSION"-1.225"
#define WHERE_FFL " - from %s %s() line %d"
#define WHERE_FFL_HERE __FILE__, __func__, __LINE__
@ -1548,6 +1548,11 @@ extern K_STORE *blocks_store;
extern tv_t blocks_stats_time;
extern bool blocks_stats_rebuild;
// Default number of blocks to display on web
#define BLOCKS_DEFAULT 42
// OptionControl can override it
#define BLOCKS_SETTING_NAME "BlocksPageSize"
// MININGPAYOUTS
typedef struct miningpayouts {
int64_t payoutid;

8
src/ckdb_cmd.c

@ -1116,7 +1116,7 @@ static char *cmd_workerstats(__maybe_unused PGconn *conn, char *cmd, char *id,
}
static char *cmd_blocklist(__maybe_unused PGconn *conn, char *cmd, char *id,
__maybe_unused tv_t *now, __maybe_unused char *by,
tv_t *now, __maybe_unused char *by,
__maybe_unused char *code, __maybe_unused char *inet,
__maybe_unused tv_t *notcd,
__maybe_unused K_TREE *trf_root)
@ -1131,10 +1131,14 @@ static char *cmd_blocklist(__maybe_unused PGconn *conn, char *cmd, char *id,
int32_t height = -1;
tv_t first_cd = {0,0}, stats_tv = {0,0}, stats_tv2 = {0,0};
int rows, srows, tot, seq;
int64_t maxrows;
bool has_stats;
LOGDEBUG("%s(): cmd '%s'", __func__, cmd);
// 0 means just the system setting
maxrows = user_sys_setting(0, BLOCKS_SETTING_NAME, BLOCKS_DEFAULT, now);
APPEND_REALLOC_INIT(buf, off, len);
APPEND_REALLOC(buf, off, len, "ok.");
@ -1158,7 +1162,7 @@ redo:
}
seq = tot;
b_item = last_in_ktree(blocks_root, ctx);
while (b_item && rows < 42) {
while (b_item && rows < (int)maxrows) {
DATA_BLOCKS(blocks, b_item);
/* For each block remember the initial createdate
* Reverse sort order the oldest expirydate is first

Loading…
Cancel
Save