@@ -63,7 +63,7 @@ def _env_or_default(name: str, default: str) -> str:
6363SUPPORT_TICKET_URL = _env_or_default ("SUPPORT_TICKET_URL" , f"{ DEFAULT_SUPPORT_BASE_URL } /api/support/upload" )
6464
6565APP_ID = "willitmod-dev-dgb"
66- APP_VERSION = "0.8.16 "
66+ APP_VERSION = "0.8.17 "
6767
6868DGB_RPC_HOST = os .getenv ("DGB_RPC_HOST" , "dgbd" )
6969DGB_RPC_PORT = int (os .getenv ("DGB_RPC_PORT" , "14022" ))
@@ -73,6 +73,7 @@ def _env_or_default(name: str, default: str) -> str:
7373SAMPLE_INTERVAL_S = int (os .getenv ("SERIES_SAMPLE_INTERVAL_S" , "30" ))
7474MAX_RETENTION_S = int (os .getenv ("SERIES_MAX_RETENTION_S" , str (7 * 24 * 60 * 60 )))
7575MAX_SERIES_POINTS = int (os .getenv ("SERIES_MAX_POINTS" , "20000" ))
76+ WORKER_STALE_SECONDS = int (os .getenv ("WORKER_STALE_SECONDS" , "900" ))
7677
7778INSTALL_ID = None
7879
@@ -228,6 +229,15 @@ def _pool_workers_from_db(pool_id: str):
228229 if hashrate_hs_f is not None and not math .isfinite (hashrate_hs_f ):
229230 hashrate_hs_f = None
230231
232+ created_dt = created if isinstance (created , datetime ) else None
233+ if created_dt is not None :
234+ try :
235+ age_s = (datetime .now (timezone .utc ) - created_dt .astimezone (timezone .utc )).total_seconds ()
236+ if WORKER_STALE_SECONDS > 0 and age_s > WORKER_STALE_SECONDS :
237+ continue
238+ except Exception :
239+ pass
240+
231241 hashrate_ths = None
232242 if hashrate_hs_f is not None :
233243 hashrate_ths = hashrate_hs_f / 1e12
@@ -252,6 +262,12 @@ def _pool_workers_from_db(pool_id: str):
252262 }
253263 )
254264
265+ # Miningcore can emit both per-worker rows and an aggregate (worker=null) row for the same miner.
266+ # If we have any named workers, hide the aggregate row so the UI doesn't under/over-count workers.
267+ has_named = any (isinstance (m .get ("worker" ), str ) and m .get ("worker" ) for m in out )
268+ if has_named :
269+ out = [m for m in out if m .get ("worker" )]
270+
255271 out .sort (key = lambda m : float (m .get ("hashrate_hs" ) or 0 ), reverse = True )
256272 with _POOL_WORKERS_LOCK :
257273 _POOL_WORKERS_CACHE [pool_id ] = {"t" : now , "workers" : out }
0 commit comments