- Fix some lint, style, error

- Pkg Error : change the register part to allow identify if a code is free or still defined
- Pkg Error : apply change of register into all modules
- Make some optimization
This commit is contained in:
Nicolas JUHEL
2020-07-15 18:24:32 +02:00
parent d080f6c107
commit 379a99afdc
41 changed files with 782 additions and 132 deletions

View File

@@ -32,8 +32,15 @@ const (
EMPTY_PARAMS errors.CodeError = iota + errors.MIN_PKG_Httpserver
)
var isCodeError = false
func IsCodeError() bool {
return isCodeError
}
func init() {
errors.RegisterFctMessage(getMessage)
isCodeError = errors.ExistInMapMessage(EMPTY_PARAMS)
errors.RegisterIdFctMessage(EMPTY_PARAMS, getMessage)
}
func getMessage(code errors.CodeError) (message string) {

View File

@@ -246,7 +246,7 @@ func (srv *modelServer) Restart() {
func (srv *modelServer) Shutdown() {
InfoLevel.Logf("Shutdown Server '%s'...", srv.addr.Host)
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), TIMEOUT_10_SEC)
defer cancel()
if srv.srv == nil {