runtime: removed trap goroutine and let the context cancelation do the thing
This commit is contained in:
@@ -6,8 +6,6 @@ import (
|
|||||||
|
|
||||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||||
|
|
||||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
|
||||||
|
|
||||||
"github.com/oklog/run"
|
"github.com/oklog/run"
|
||||||
"github.com/owncloud/ocis/accounts/pkg/config"
|
"github.com/owncloud/ocis/accounts/pkg/config"
|
||||||
"github.com/owncloud/ocis/accounts/pkg/metrics"
|
"github.com/owncloud/ocis/accounts/pkg/metrics"
|
||||||
@@ -85,10 +83,6 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
cancel()
|
cancel()
|
||||||
})
|
})
|
||||||
|
|
||||||
if !cfg.Supervised {
|
|
||||||
sync.Trap(&gr, cancel)
|
|
||||||
}
|
|
||||||
|
|
||||||
return gr.Run()
|
return gr.Run()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,7 +14,6 @@ import (
|
|||||||
"github.com/owncloud/ocis/glauth/pkg/tracing"
|
"github.com/owncloud/ocis/glauth/pkg/tracing"
|
||||||
pkgcrypto "github.com/owncloud/ocis/ocis-pkg/crypto"
|
pkgcrypto "github.com/owncloud/ocis/ocis-pkg/crypto"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
|
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -178,10 +177,6 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cfg.Supervised {
|
|
||||||
sync.Trap(&gr, cancel)
|
|
||||||
}
|
|
||||||
|
|
||||||
return gr.Run()
|
return gr.Run()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import (
|
|||||||
"github.com/owncloud/ocis/graph-explorer/pkg/server/debug"
|
"github.com/owncloud/ocis/graph-explorer/pkg/server/debug"
|
||||||
"github.com/owncloud/ocis/graph-explorer/pkg/server/http"
|
"github.com/owncloud/ocis/graph-explorer/pkg/server/http"
|
||||||
"github.com/owncloud/ocis/graph-explorer/pkg/tracing"
|
"github.com/owncloud/ocis/graph-explorer/pkg/tracing"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -95,10 +94,6 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cfg.Supervised {
|
|
||||||
sync.Trap(&gr, cancel)
|
|
||||||
}
|
|
||||||
|
|
||||||
return gr.Run()
|
return gr.Run()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import (
|
|||||||
"github.com/owncloud/ocis/graph/pkg/server/debug"
|
"github.com/owncloud/ocis/graph/pkg/server/debug"
|
||||||
"github.com/owncloud/ocis/graph/pkg/server/http"
|
"github.com/owncloud/ocis/graph/pkg/server/http"
|
||||||
"github.com/owncloud/ocis/graph/pkg/tracing"
|
"github.com/owncloud/ocis/graph/pkg/tracing"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -92,10 +91,6 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cfg.Supervised {
|
|
||||||
sync.Trap(&gr, cancel)
|
|
||||||
}
|
|
||||||
|
|
||||||
return gr.Run()
|
return gr.Run()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ import (
|
|||||||
"github.com/owncloud/ocis/idp/pkg/server/debug"
|
"github.com/owncloud/ocis/idp/pkg/server/debug"
|
||||||
"github.com/owncloud/ocis/idp/pkg/server/http"
|
"github.com/owncloud/ocis/idp/pkg/server/http"
|
||||||
"github.com/owncloud/ocis/idp/pkg/tracing"
|
"github.com/owncloud/ocis/idp/pkg/tracing"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -96,10 +95,6 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cfg.Supervised {
|
|
||||||
sync.Trap(&gr, cancel)
|
|
||||||
}
|
|
||||||
|
|
||||||
return gr.Run()
|
return gr.Run()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -13,7 +13,6 @@ func StorageMetadataCommand(cfg *config.Config) *cli.Command {
|
|||||||
Name: "storage-metadata",
|
Name: "storage-metadata",
|
||||||
Usage: "Start storage and data service for metadata",
|
Usage: "Start storage and data service for metadata",
|
||||||
Category: "Extensions",
|
Category: "Extensions",
|
||||||
//Flags: flagset.StorageMetadata(cfg.Storage),
|
|
||||||
Before: func(ctx *cli.Context) error {
|
Before: func(ctx *cli.Context) error {
|
||||||
return ParseStorageCommon(ctx, cfg)
|
return ParseStorageCommon(ctx, cfg)
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -22,7 +22,8 @@ func Run(cfg *config.Config) *cobra.Command {
|
|||||||
log.Fatal("dialing:", err)
|
log.Fatal("dialing:", err)
|
||||||
}
|
}
|
||||||
var res int
|
var res int
|
||||||
if err := client.Call("Service.Start", &args[0], &res); err != nil {
|
|
||||||
|
if err = client.Call("Service.Start", &args[0], &res); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -137,9 +137,6 @@ func Start(o ...Option) error {
|
|||||||
halt := make(chan os.Signal, 1)
|
halt := make(chan os.Signal, 1)
|
||||||
signal.Notify(halt, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP)
|
signal.Notify(halt, syscall.SIGINT, syscall.SIGTERM, syscall.SIGQUIT, syscall.SIGHUP)
|
||||||
|
|
||||||
// notify goroutines that they are running on supervised mode
|
|
||||||
s.cfg.Mode = ociscfg.SUPERVISED
|
|
||||||
|
|
||||||
setMicroLogger()
|
setMicroLogger()
|
||||||
|
|
||||||
// tolerance controls backoff cycles from the supervisor.
|
// tolerance controls backoff cycles from the supervisor.
|
||||||
@@ -191,7 +188,7 @@ func Start(o ...Option) error {
|
|||||||
defer func() {
|
defer func() {
|
||||||
if r := recover(); r != nil {
|
if r := recover(); r != nil {
|
||||||
reason := strings.Builder{}
|
reason := strings.Builder{}
|
||||||
if _, err := net.Dial("tcp", net.JoinHostPort(s.cfg.Runtime.Host, s.cfg.Runtime.Port)); err != nil {
|
if _, err = net.Dial("tcp", net.JoinHostPort(s.cfg.Runtime.Host, s.cfg.Runtime.Port)); err != nil {
|
||||||
reason.WriteString("runtime address already in use")
|
reason.WriteString("runtime address already in use")
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,11 +253,6 @@ func (s *Service) generateRunSet(cfg *config.Config) {
|
|||||||
|
|
||||||
// Start indicates the Service Controller to start a new supervised service as an OS thread.
|
// Start indicates the Service Controller to start a new supervised service as an OS thread.
|
||||||
func (s *Service) Start(name string, reply *int) error {
|
func (s *Service) Start(name string, reply *int) error {
|
||||||
// RPC calls to a Service object will allow for parsing config. Mind that since the runtime is running on a different
|
|
||||||
// machine, the configuration needs to be present in the given machine. RPC does not yet allow providing a config
|
|
||||||
// during transport.
|
|
||||||
s.cfg.Mode = ociscfg.UNSUPERVISED
|
|
||||||
|
|
||||||
swap := deepcopy.Copy(s.cfg)
|
swap := deepcopy.Copy(s.cfg)
|
||||||
if _, ok := s.ServicesRegistry[name]; ok {
|
if _, ok := s.ServicesRegistry[name]; ok {
|
||||||
*reply = 0
|
*reply = 0
|
||||||
@@ -306,7 +298,7 @@ func (s *Service) List(args struct{}, reply *string) error {
|
|||||||
func (s *Service) Kill(name string, reply *int) error {
|
func (s *Service) Kill(name string, reply *int) error {
|
||||||
if len(s.serviceToken[name]) > 0 {
|
if len(s.serviceToken[name]) > 0 {
|
||||||
for i := range s.serviceToken[name] {
|
for i := range s.serviceToken[name] {
|
||||||
if err := s.Supervisor.Remove(s.serviceToken[name][i]); err != nil {
|
if err := s.Supervisor.RemoveAndWait(s.serviceToken[name][i], 5000*time.Millisecond); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,8 +6,6 @@ import (
|
|||||||
|
|
||||||
"github.com/owncloud/ocis/ocs/pkg/tracing"
|
"github.com/owncloud/ocis/ocs/pkg/tracing"
|
||||||
|
|
||||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
|
||||||
|
|
||||||
"github.com/oklog/run"
|
"github.com/oklog/run"
|
||||||
"github.com/owncloud/ocis/ocs/pkg/config"
|
"github.com/owncloud/ocis/ocs/pkg/config"
|
||||||
"github.com/owncloud/ocis/ocs/pkg/metrics"
|
"github.com/owncloud/ocis/ocs/pkg/metrics"
|
||||||
@@ -100,10 +98,6 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cfg.Supervised {
|
|
||||||
sync.Trap(&gr, cancel)
|
|
||||||
}
|
|
||||||
|
|
||||||
return gr.Run()
|
return gr.Run()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,6 @@ import (
|
|||||||
"github.com/owncloud/ocis/ocis-pkg/log"
|
"github.com/owncloud/ocis/ocis-pkg/log"
|
||||||
pkgmiddleware "github.com/owncloud/ocis/ocis-pkg/middleware"
|
pkgmiddleware "github.com/owncloud/ocis/ocis-pkg/middleware"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
|
"github.com/owncloud/ocis/ocis-pkg/service/grpc"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
|
||||||
"github.com/owncloud/ocis/proxy/pkg/config"
|
"github.com/owncloud/ocis/proxy/pkg/config"
|
||||||
"github.com/owncloud/ocis/proxy/pkg/cs3"
|
"github.com/owncloud/ocis/proxy/pkg/cs3"
|
||||||
"github.com/owncloud/ocis/proxy/pkg/metrics"
|
"github.com/owncloud/ocis/proxy/pkg/metrics"
|
||||||
@@ -138,10 +137,6 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cfg.Supervised {
|
|
||||||
sync.Trap(&gr, cancel)
|
|
||||||
}
|
|
||||||
|
|
||||||
return gr.Run()
|
return gr.Run()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/oklog/run"
|
"github.com/oklog/run"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
|
||||||
"github.com/owncloud/ocis/settings/pkg/config"
|
"github.com/owncloud/ocis/settings/pkg/config"
|
||||||
"github.com/owncloud/ocis/settings/pkg/metrics"
|
"github.com/owncloud/ocis/settings/pkg/metrics"
|
||||||
"github.com/owncloud/ocis/settings/pkg/server/debug"
|
"github.com/owncloud/ocis/settings/pkg/server/debug"
|
||||||
@@ -83,10 +82,6 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
cancel()
|
cancel()
|
||||||
})
|
})
|
||||||
|
|
||||||
if !cfg.Supervised {
|
|
||||||
sync.Trap(&servers, cancel)
|
|
||||||
}
|
|
||||||
|
|
||||||
return servers.Run()
|
return servers.Run()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,8 +9,6 @@ import (
|
|||||||
|
|
||||||
"github.com/owncloud/ocis/store/pkg/tracing"
|
"github.com/owncloud/ocis/store/pkg/tracing"
|
||||||
|
|
||||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
|
||||||
|
|
||||||
"github.com/oklog/run"
|
"github.com/oklog/run"
|
||||||
"github.com/owncloud/ocis/store/pkg/config"
|
"github.com/owncloud/ocis/store/pkg/config"
|
||||||
"github.com/owncloud/ocis/store/pkg/metrics"
|
"github.com/owncloud/ocis/store/pkg/metrics"
|
||||||
@@ -103,10 +101,6 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cfg.Supervised {
|
|
||||||
sync.Trap(&gr, cancel)
|
|
||||||
}
|
|
||||||
|
|
||||||
return gr.Run()
|
return gr.Run()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/oklog/run"
|
"github.com/oklog/run"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
|
||||||
"github.com/owncloud/ocis/thumbnails/pkg/config"
|
"github.com/owncloud/ocis/thumbnails/pkg/config"
|
||||||
"github.com/owncloud/ocis/thumbnails/pkg/metrics"
|
"github.com/owncloud/ocis/thumbnails/pkg/metrics"
|
||||||
"github.com/owncloud/ocis/thumbnails/pkg/server/debug"
|
"github.com/owncloud/ocis/thumbnails/pkg/server/debug"
|
||||||
@@ -78,10 +77,6 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
cancel()
|
cancel()
|
||||||
})
|
})
|
||||||
|
|
||||||
if !cfg.Supervised {
|
|
||||||
sync.Trap(&gr, cancel)
|
|
||||||
}
|
|
||||||
|
|
||||||
return gr.Run()
|
return gr.Run()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,7 +7,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/oklog/run"
|
"github.com/oklog/run"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
|
||||||
"github.com/owncloud/ocis/web/pkg/config"
|
"github.com/owncloud/ocis/web/pkg/config"
|
||||||
"github.com/owncloud/ocis/web/pkg/metrics"
|
"github.com/owncloud/ocis/web/pkg/metrics"
|
||||||
"github.com/owncloud/ocis/web/pkg/server/debug"
|
"github.com/owncloud/ocis/web/pkg/server/debug"
|
||||||
@@ -124,10 +123,6 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cfg.Supervised {
|
|
||||||
sync.Trap(&gr, cancel)
|
|
||||||
}
|
|
||||||
|
|
||||||
return gr.Run()
|
return gr.Run()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,7 +5,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"github.com/oklog/run"
|
"github.com/oklog/run"
|
||||||
"github.com/owncloud/ocis/ocis-pkg/sync"
|
|
||||||
"github.com/owncloud/ocis/webdav/pkg/config"
|
"github.com/owncloud/ocis/webdav/pkg/config"
|
||||||
"github.com/owncloud/ocis/webdav/pkg/metrics"
|
"github.com/owncloud/ocis/webdav/pkg/metrics"
|
||||||
"github.com/owncloud/ocis/webdav/pkg/server/debug"
|
"github.com/owncloud/ocis/webdav/pkg/server/debug"
|
||||||
@@ -100,10 +99,6 @@ func Server(cfg *config.Config) *cli.Command {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
if !cfg.Supervised {
|
|
||||||
sync.Trap(&gr, cancel)
|
|
||||||
}
|
|
||||||
|
|
||||||
return gr.Run()
|
return gr.Run()
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user