Private
Public Access
1
0

Calculate netspeed points, too
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2023-07-16 02:40:50 -07:00
parent 1f7973e885
commit 27c8bc4776
11 changed files with 281 additions and 123 deletions

View File

@@ -5,3 +5,34 @@ FROM zone_server_counts zc USE INDEX (date_idx)
ON(zc.zone_id=z.id)
WHERE date IN (SELECT max(date) from zone_server_counts)
ORDER BY name;
-- name: GetServerNetspeed :one
select netspeed from servers where ip = ?;
-- name: GetZoneStatsV2 :many
select zone_name, netspeed_active+0 as netspeed_active FROM (
SELECT
z.name as zone_name,
SUM(
IF (deletion_on IS NULL AND score_raw > 10,
netspeed,
0
)
) AS netspeed_active
FROM
servers s
INNER JOIN server_zones sz ON (sz.server_id = s.id)
INNER JOIN zones z ON (z.id = sz.zone_id)
INNER JOIN (
select zone_id, s.ip_version
from server_zones sz
inner join servers s on (s.id=sz.server_id)
where s.ip=?
) as srvz on (srvz.zone_id=z.id AND srvz.ip_version=s.ip_version)
WHERE
(deletion_on IS NULL OR deletion_on > NOW())
AND in_pool = 1
AND netspeed > 0
GROUP BY z.name)
AS server_netspeed