sql: also add a stratum start time column

time column is refreshed at regular interval by the process
This commit is contained in:
Tanguy Pruvot 2018-01-01 12:57:39 +01:00
parent 472b4d7635
commit 41821cee93
2 changed files with 4 additions and 2 deletions

View file

@ -3,6 +3,8 @@
-- filled by the stratum instance, to allow to handle/watch multiple instances -- filled by the stratum instance, to allow to handle/watch multiple instances
ALTER TABLE `stratums` ADD `started` int(11) UNSIGNED NULL AFTER `time`;
ALTER TABLE `stratums` ADD `workers` int(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `algo`; ALTER TABLE `stratums` ADD `workers` int(10) UNSIGNED NOT NULL DEFAULT '0' AFTER `algo`;
ALTER TABLE `stratums` ADD `port` int(6) UNSIGNED NULL AFTER `workers`; ALTER TABLE `stratums` ADD `port` int(6) UNSIGNED NULL AFTER `workers`;

View file

@ -87,9 +87,9 @@ void db_register_stratum(YAAMP_DB *db)
int t = time(NULL); int t = time(NULL);
if(!db) return; if(!db) return;
db_query(db, "INSERT INTO stratums (pid, time, algo, port) VALUES (%d, %d, '%s', %d) " db_query(db, "INSERT INTO stratums (pid, time, started, algo, port) VALUES (%d, %d, %d, '%s', %d) "
" ON DUPLICATE KEY UPDATE time=%d, algo='%s', port=%d", " ON DUPLICATE KEY UPDATE time=%d, algo='%s', port=%d",
pid, t, g_stratum_algo, g_tcp_port, pid, t, t, g_stratum_algo, g_tcp_port,
t, g_stratum_algo, g_tcp_port t, g_stratum_algo, g_tcp_port
); );
} }