Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
小 白蛋
Nomad
Commits
2de0f72c
Unverified
Commit
2de0f72c
authored
3 years ago
by
James Rasell
Browse files
Options
Download
Email Patches
Plain Diff
WIP: use Set() and launch go routine for render.
parent
12e5de4a
Branches unavailable
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
command/deployment_status.go
+11
-9
command/deployment_status.go
with
11 additions
and
9 deletions
+11
-9
command/deployment_status.go
+
11
-
9
View file @
2de0f72c
...
...
@@ -10,8 +10,6 @@ import (
"time"
"github.com/docker/docker/pkg/term"
"github.com/hashicorp/nomad/api"
"github.com/hashicorp/nomad/api/contexts"
"github.com/hashicorp/nomad/nomad/structs"
glint
"github.com/mitchellh/go-glint"
"github.com/posener/complete"
...
...
@@ -404,7 +402,10 @@ func (c *DeploymentStatusCommand) monitor(client *api.Client, deployID string, i
// writer.Start()
d
:=
glint
.
New
()
// d.SetRefreshRate(500 * time.Millisecond)
d
.
SetRefreshRate
(
500
*
time
.
Millisecond
)
ctx
:=
context
.
Background
()
go
d
.
Render
(
ctx
)
defer
ctx
.
Done
()
q
:=
api
.
QueryOptions
{
AllowStale
:
true
,
...
...
@@ -447,10 +448,11 @@ func (c *DeploymentStatusCommand) monitor(client *api.Client, deployID string, i
_
,
isStdoutTerminal
:=
term
.
GetFdInfo
(
os
.
Stdout
)
if
isStdoutTerminal
{
// fmt.Fprint(writer, msg)
d
.
Append
(
glint
.
TextFunc
(
func
(
row
,
cols
uint
)
string
{
return
msg
}),
d
.
Set
(
glint
.
Style
(
glint
.
TextFunc
(
func
(
row
,
cols
uint
)
string
{
return
msg
})),
)
}
else
{
c
.
Ui
.
Output
(
msg
)
...
...
@@ -481,8 +483,8 @@ func (c *DeploymentStatusCommand) monitor(client *api.Client, deployID string, i
continue
}
d
.
Render
(
context
.
Background
())
context
.
Background
()
.
Done
()
//
d.Render(context.Background())
//
context.Background().Done()
// writer.Stop()
return
}
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Projects
Groups
Snippets
Help