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