Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
69497a1b
Commit
69497a1b
authored
8 years ago
by
Sameer Al-Sakran
Browse files
Options
Downloads
Patches
Plain Diff
clean up logic
parent
e20c1045
Loading
Loading
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/metabase/events/metabot_lifecycle.clj
+13
-6
13 additions, 6 deletions
src/metabase/events/metabot_lifecycle.clj
src/metabase/metabot.clj
+10
-0
10 additions, 0 deletions
src/metabase/metabot.clj
with
23 additions
and
6 deletions
src/metabase/events/metabot_lifecycle.clj
+
13
−
6
View file @
69497a1b
...
...
@@ -27,12 +27,19 @@
(
when-let
[{
topic
:topic
object
:item
}
metabot-lifecycle-event
]
(
try
;; if someone updated our slack-token, or metabot was enabled/disabled then react accordingly
(
let
[{
:keys
[
slack-token
metabot-enabled
]}
object
]
(
cond
(
and
(
contains?
object
:metabot-enabled
)
(
not
metabot-enabled
))
(
metabot/stop-metabot!
)
(
and
(
contains?
object
:slack-token
)
(
seq
slack-token
))
(
metabot/start-metabot!
)))
(
when
(
and
(
contains?
object
:metabot-enabled
)
(
contains?
object
:slack-token
))
(
let
[{
:keys
[
slack-token
metabot-enabled
]}
object
]
(
cond
(
nil?
slack-token
)
(
metabot/stop-metabot!
)
(
not
metabot-enabled
)
(
metabot/stop-metabot!
)
:else
(
metabot/restart-metabot!
))))
; (let [{:keys [slack-token metabot-enabled]} object]
; (cond
; (and (contains? object :metabot-enabled)
; (not metabot-enabled)) (metabot/stop-metabot!)
; (and (contains? object :slack-token)
; (seq slack-token)) (metabot/start-metabot!)))
(
catch
Throwable
e
(
log/warn
(
format
"Failed to process driver notifications event. %s"
topic
)
e
)))))
...
...
This diff is collapsed.
Click to expand it.
src/metabase/metabot.clj
+
10
−
0
View file @
69497a1b
...
...
@@ -317,3 +317,13 @@
(
log/info
"Stopping MetaBot... 🤖"
)
(
reset!
websocket-monitor-thread-id
nil
)
(
disconnect-websocket!
))
(
defn
restart-metabot!
"Restart the Metaot.
Used on settings changed"
[]
(
when
@
websocket-monitor-thread-id
(
log/info
"Metabot already running. Killing the previous WebSocket listener first."
)
(
stop-metabot!
))
(
start-metabot!
)
)
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