Skip to content

Commit

Permalink
Vercel loc test, commit
Browse files Browse the repository at this point in the history
  • Loading branch information
vigneshshettyin committed Jun 2, 2024
1 parent f0a6322 commit d3ddc44
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
6 changes: 4 additions & 2 deletions kafka/fixtures/kafka_consumer.sql
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,12 @@ CREATE TABLE click_analytics (
`device` LowCardinality(String),
`country` LowCardinality(String),
`region` String,
`city` String
`city` String,
`timestamp` Date DEFAULT toDate(now())
)
ENGINE = MergeTree()
ORDER BY (code, browser, os, device, country);
PARTITION BY toYYYYMM(timestamp)
ORDER BY (code, timestamp, browser, os, device, country);

-- Create a Materialized View named 'click_analytics_consumer' to transfer data from the Kafka table to the ClickHouse table
-- The view selects all columns from 'eurl_kafka' and inserts them into the 'click_analytics' table
Expand Down
20 changes: 18 additions & 2 deletions lib/services/redisPublicGenerate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,24 @@ const checkIfShortCodePublic = (shortCode: string): boolean => {

const publishUserAgent = async (req: NextRequest, code: string) => {
const userAgent = userAgentAnlytics(req);
await pubSubRedis.publish(
"user_anlytics",
const tmp_test_data = {
city : req.geo!.city,
country : req.geo!.country,
region : req.geo!.region,
lat : req.geo!.latitude,
long :req.geo!.longitude
}

await pubSubRedis.lpush(
"user_location",
JSON.stringify({
code,
...tmp_test_data,
})
);

await pubSubRedis.lpush(
"user_analytics",
JSON.stringify({
code,
...userAgent,
Expand Down

0 comments on commit d3ddc44

Please sign in to comment.