component/dis: Check if instance alive
This commit is contained in:
parent
37cdd201f0
commit
492a0c0404
8 changed files with 145 additions and 22 deletions
22
internal/component/instances/wisski_status.go
Normal file
22
internal/component/instances/wisski_status.go
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
package instances
|
||||
|
||||
import "github.com/tkw1536/goprogram/stream"
|
||||
|
||||
// Info represents some info about this WissKI
|
||||
type Info struct {
|
||||
Slug string // The slug of the instance
|
||||
|
||||
Running bool // is the instance running?
|
||||
}
|
||||
|
||||
// Info returns info about this instance
|
||||
func (wisski *WissKI) Info() (info Info, err error) {
|
||||
info.Slug = wisski.Slug
|
||||
|
||||
ps, err := wisski.Barrel().Ps(stream.FromNil())
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
info.Running = len(ps) > 0
|
||||
return
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue