Compare commits
3 Commits
735d314a19
...
v0.3.5
| Author | SHA1 | Date | |
|---|---|---|---|
| 126374fbac | |||
| 02f06d857e | |||
| 3d25441e7a |
@@ -137,11 +137,13 @@ func (this *environment) Del(ctx context.Context, actors ...Actor) error {
|
|||||||
channels := []<- chan struct { } { }
|
channels := []<- chan struct { } { }
|
||||||
for _, actor := range actors {
|
for _, actor := range actors {
|
||||||
info := this.info(actor)
|
info := this.info(actor)
|
||||||
if info.done != nil {
|
if info.stopped != nil {
|
||||||
channels = append(channels, info.stopped)
|
channels = append(channels, info.stopped)
|
||||||
}
|
}
|
||||||
|
info.done()
|
||||||
}
|
}
|
||||||
for _, channel := range channels {
|
for _, channel := range channels {
|
||||||
|
if channel == nil { continue }
|
||||||
select {
|
select {
|
||||||
case <- channel:
|
case <- channel:
|
||||||
case <- ctx.Done():
|
case <- ctx.Done():
|
||||||
@@ -250,7 +252,11 @@ func (this *environment) run(actor Actor) {
|
|||||||
// contains context information
|
// contains context information
|
||||||
info := this.info(actor)
|
info := this.info(actor)
|
||||||
ctx := info.ctx
|
ctx := info.ctx
|
||||||
defer close(info.stopped)
|
defer func() {
|
||||||
|
if info.stopped != nil {
|
||||||
|
close(info.stopped)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
switch actor := actor.(type) {
|
switch actor := actor.(type) {
|
||||||
case Runnable:
|
case Runnable:
|
||||||
|
|||||||
12
phases.go
12
phases.go
@@ -6,6 +6,7 @@ import "log"
|
|||||||
import "io/fs"
|
import "io/fs"
|
||||||
import "errors"
|
import "errors"
|
||||||
import "context"
|
import "context"
|
||||||
|
import "runtime"
|
||||||
import "strings"
|
import "strings"
|
||||||
import "path/filepath"
|
import "path/filepath"
|
||||||
import "git.tebibyte.media/sashakoshka/go-cli"
|
import "git.tebibyte.media/sashakoshka/go-cli"
|
||||||
@@ -129,15 +130,15 @@ func (this *environment) phase30ConfigurationParsing() bool {
|
|||||||
log.Println("!!! (30) could not determine location of file(s):", err)
|
log.Println("!!! (30) could not determine location of file(s):", err)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
if this.flags.configFile != "" {
|
||||||
|
paths = append(paths, this.flags.configFile)
|
||||||
|
}
|
||||||
if this.Verb() {
|
if this.Verb() {
|
||||||
log.Println("(i) (30) have configuration files:")
|
log.Println("(i) (30) have configuration files:")
|
||||||
for _, paths := range paths {
|
for _, paths := range paths {
|
||||||
log.Println("(i) (30) -", paths)
|
log.Println("(i) (30) -", paths)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if this.flags.configFile != "" {
|
|
||||||
paths = append(paths, this.flags.configFile)
|
|
||||||
}
|
|
||||||
// parse every config and merge them all
|
// parse every config and merge them all
|
||||||
configs := make([]iniConfig, 0, len(paths))
|
configs := make([]iniConfig, 0, len(paths))
|
||||||
for _, path := range paths {
|
for _, path := range paths {
|
||||||
@@ -273,6 +274,11 @@ func (this *environment) phase80Shutdown() bool {
|
|||||||
<- ctx.Done()
|
<- ctx.Done()
|
||||||
if errors.Is(context.Cause(ctx), context.DeadlineExceeded) {
|
if errors.Is(context.Cause(ctx), context.DeadlineExceeded) {
|
||||||
log.Println("XXX (80) shutdown timeout expired, performing emergency halt")
|
log.Println("XXX (80) shutdown timeout expired, performing emergency halt")
|
||||||
|
if Verb() {
|
||||||
|
dumpBuffer := make([]byte, 8192)
|
||||||
|
runtime.Stack(dumpBuffer, true)
|
||||||
|
log.Printf("XXX (80) stack trace of all goroutines:\n%s", dumpBuffer)
|
||||||
|
}
|
||||||
log.Printf("====== [%s] END =======", this.name)
|
log.Printf("====== [%s] END =======", this.name)
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user