Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
cf-online-api
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
KS Pardubický kraj
cf-online-api
Commits
c8d750ab
Verified
Commit
c8d750ab
authored
3 years ago
by
Andrej Ramašeuski
Browse files
Options
Downloads
Patches
Plain Diff
Debug output, fix members size
parent
7921d4b7
No related branches found
No related tags found
No related merge requests found
Pipeline
#7015
passed
3 years ago
Stage: build
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
openapi.yaml
+1
-1
1 addition, 1 deletion
openapi.yaml
tools/online-counter/online.go
+13
-3
13 additions, 3 deletions
tools/online-counter/online.go
with
14 additions
and
4 deletions
openapi.yaml
+
1
−
1
View file @
c8d750ab
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
:
...
...
This diff is collapsed.
Click to expand it.
tools/online-counter/online.go
+
13
−
3
View file @
c8d750ab
...
@@ -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
.
Print
ln
(
topic
,
message
)
fmt
.
Print
f
(
"Counts for event %s: %s
\n
"
,
event
,
message
)
}
}
err
=
rdb
.
Publish
(
ctx
,
topic
,
message
)
.
Err
()
err
=
rdb
.
Publish
(
ctx
,
topic
,
message
)
.
Err
()
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment