Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MosógépSCH
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
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Disappointment industries™
MosógépSCH
Commits
e3c8f885
Commit
e3c8f885
authored
Feb 15, 2022
by
Réthelyi Bálint
Browse files
Options
Downloads
Plain Diff
Merge branch 'fix-notification' into 'main'
Fix notification daemon See merge request
!1
parents
49a03d92
75cd451d
Branches
Branches containing commit
No related tags found
1 merge request
!1
Fix notification daemon
Pipeline
#18211
passed
Feb 15, 2022
Stage: build
Stage: docker
Stage: deploy
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+2
-0
2 additions, 0 deletions
.gitlab-ci.yml
notifications/main.go
+1
-34
1 addition, 34 deletions
notifications/main.go
with
3 additions
and
34 deletions
.gitlab-ci.yml
+
2
−
0
View file @
e3c8f885
...
...
@@ -83,6 +83,8 @@ dockerhub:
changes
:
-
notifications/**/*
-
.gitlab-ci.yml
refs
:
-
main
k8s
:
stage
:
deploy
...
...
This diff is collapsed.
Click to expand it.
notifications/main.go
+
1
−
34
View file @
e3c8f885
...
...
@@ -15,10 +15,8 @@ var oldLaundry []model.LaundryRoom
func
main
()
{
url
:=
"https://mosogep.sch.bme.hu/api/v1/laundry-room/"
state
:=
0
for
{
sendMsg
(
url
)
state
=
testMsg
(
state
)
time
.
Sleep
(
time
.
Second
*
30
)
}
...
...
@@ -47,6 +45,7 @@ func sendMsg(url string) {
old
:=
findOldMachine
(
machine
.
Id
)
if
old
.
Status
!=
machine
.
Status
{
machine
.
LastQueryTime
=
room
.
LastQueryTime
machine
.
FloorId
=
fmt
.
Sprintf
(
"%d"
,
room
.
Id
)
marshal
,
err
:=
json
.
Marshal
(
machine
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
...
...
@@ -66,35 +65,3 @@ func sendMsg(url string) {
}
oldLaundry
=
laundryRooms
}
func
testMsg
(
oldState
int
)
int
{
//fmt.Println("test sending...")
var
state
int
if
oldState
==
0
{
state
=
1
}
else
{
state
=
0
}
machine
:=
model
.
Machine
{
Id
:
420
,
KindOf
:
"DR"
,
Status
:
state
,
Message
:
""
,
LastQueryTime
:
time
.
Now
(),
}
marshal
,
err
:=
json
.
Marshal
(
machine
)
if
err
!=
nil
{
log
.
Fatal
(
err
)
}
data
:=
map
[
string
]
string
{
"floor"
:
"69"
,
"old_state"
:
fmt
.
Sprintf
(
"%d"
,
oldState
),
"machine"
:
string
(
marshal
),
}
err
=
firebase
.
Send
(
"test"
,
data
)
if
err
!=
nil
{
fmt
.
Println
(
err
)
}
//fmt.Println("test sent...")
return
state
}
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