diff --git a/openapi.yaml b/openapi.yaml index 2962988085a127503ce1e372f31330395030de8f..4ae6b284fdf1778c9b9f4612f2127885c81de032 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -1,7 +1,7 @@ openapi: 3.0.3 info: - version: "3.1.0" + version: "3.1.1" title: CF Online description: CF Online license: diff --git a/tools/online-counter/online.go b/tools/online-counter/online.go index 69a5ab59da69a05d116fe8f8b9999e5ba5da446d..d95c1ed1cafc1d2a5bb2d5445222ef9afa5d6d45 100644 --- a/tools/online-counter/online.go +++ b/tools/online-counter/online.go @@ -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()