Skip to content

Commit

Permalink
备注聚合代码
Browse files Browse the repository at this point in the history
  • Loading branch information
Ghost-chu committed Dec 20, 2024
1 parent c24dd15 commit dbef607
Showing 1 changed file with 18 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,24 @@ public void cronUntrustedIPAddresses() throws InterruptedException {
DatabaseCare.generateParallel.acquire();
var startAt = System.currentTimeMillis();
var ipTries = new DualIPv4v6Tries();
/*
CREATE MATERIALIZED VIEW progress_cheat_blocker_agg_view
WITH (timescaledb.continuous) AS
SELECT
time_bucket(INTERVAL '1 hour', insert_time) AS bucket,
peer_ip,
COUNT(DISTINCT user_application) AS app_count
FROM banhistory
WHERE module = 'com.ghostchu.peerbanhelper.module.impl.rule.ProgressCheatBlocker'
GROUP BY bucket, peer_ip
WITH NO DATA;
SELECT add_continuous_aggregate_policy('progress_cheat_blocker_agg_view',
start_offset => INTERVAL '7 day',
end_offset => INTERVAL '1 minute',
schedule_interval => INTERVAL '1 hour');
*/
var query = entityManager.createNativeQuery("""
SELECT peer_ip, SUM(app_count) AS untrust_count
FROM progress_cheat_blocker_agg_view
Expand Down

0 comments on commit dbef607

Please sign in to comment.