add balance/mean-reversion signal and Cloudflare visitor logging
Balance signal (15% weight) favors under-represented chairs over last 50 games. Visitor middleware captures real IPs from CF headers, batched into ClickHouse with 90-day TTL.
This commit is contained in:
@@ -40,3 +40,16 @@ CREATE TABLE IF NOT EXISTS users (
|
||||
updated_at DateTime DEFAULT now()
|
||||
) ENGINE = ReplacingMergeTree(updated_at)
|
||||
ORDER BY user_id;
|
||||
|
||||
CREATE TABLE IF NOT EXISTS visitors (
|
||||
ip String,
|
||||
country String,
|
||||
path String,
|
||||
method String,
|
||||
user_agent String,
|
||||
referer String,
|
||||
accept_lang String,
|
||||
created_at DateTime DEFAULT now()
|
||||
) ENGINE = MergeTree()
|
||||
ORDER BY (created_at, ip)
|
||||
TTL created_at + INTERVAL 90 DAY;
|
||||
|
||||
Reference in New Issue
Block a user