Skip to content
Snippets Groups Projects
Verified Commit c8d750ab authored by Andrej Ramašeuski's avatar Andrej Ramašeuski
Browse files

Debug output, fix members size

parent 7921d4b7
No related branches found
No related tags found
No related merge requests found
Pipeline #7015 passed
openapi: 3.0.3 openapi: 3.0.3
info: info:
version: "3.1.0" version: "3.1.1"
title: CF Online title: CF Online
description: CF Online description: CF Online
license: license:
......
...@@ -20,6 +20,12 @@ const tarpitFactor = 1000.0 ...@@ -20,6 +20,12 @@ const tarpitFactor = 1000.0
func main() { func main() {
debug := os.Getenv("DEBUG") != ""
if debug {
fmt.Println("Starting")
}
// konfigurace redis klienta // konfigurace redis klienta
options, err := redis.ParseURL(os.Getenv("CFG_REDIS")) options, err := redis.ParseURL(os.Getenv("CFG_REDIS"))
if err != nil { if err != nil {
...@@ -30,6 +36,10 @@ func main() { ...@@ -30,6 +36,10 @@ func main() {
rdb := redis.NewClient(options) rdb := redis.NewClient(options)
ctx := rdb.Context() ctx := rdb.Context()
if debug {
fmt.Println("Connected to redis")
}
// ukonceni prace redis klienta // ukonceni prace redis klienta
defer func() { defer func() {
err := rdb.Close() err := rdb.Close()
...@@ -61,7 +71,7 @@ func main() { ...@@ -61,7 +71,7 @@ func main() {
if isMember { if isMember {
event.Members++ event.Members++
} }
event.GroupSizeFull, event.GroupSizeHalf = member_group_size(event.All) event.GroupSizeFull, event.GroupSizeHalf = member_group_size(event.Members)
online[key[1]] = event online[key[1]] = event
} }
...@@ -85,8 +95,8 @@ func main() { ...@@ -85,8 +95,8 @@ func main() {
message := fmt.Sprintf("%v", count) message := fmt.Sprintf("%v", count)
message = message[1 : len(message)-1] message = message[1 : len(message)-1]
if os.Getenv("DEBUG") != "" { if debug {
fmt.Println(topic, message) fmt.Printf("Counts for event %s: %s\n", event, message)
} }
err = rdb.Publish(ctx, topic, message).Err() err = rdb.Publish(ctx, topic, message).Err()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment