Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions config/services.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ type Services struct {
WebhookHandler *handlers.WebhookHandler
Logger *slog.Logger
Config *Config
ownsP2PClient bool
}

// Initialize creates and returns all application services.
Expand Down Expand Up @@ -286,6 +287,7 @@ func (c *Config) initializeEmbedded(ctx context.Context, logger *slog.Logger, ch
WebhookHandler: webhookHandler,
Logger: logger,
Config: c,
ownsP2PClient: ownsP2PClient,
}, nil
}

Expand Down Expand Up @@ -316,8 +318,8 @@ func (s *Services) Close() error {
}
}

// Close P2P client (also stops Chaintracks via context)
if s.P2PClient != nil {
// Close P2P client only if we created it (caller owns it otherwise)
if s.P2PClient != nil && s.ownsP2PClient {
if err := s.P2PClient.Close(); err != nil {
errs = append(errs, fmt.Errorf("p2p client close: %w", err))
}
Expand Down
20 changes: 9 additions & 11 deletions docs/docs.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Package docs Code generated by swaggo/swag. DO NOT EDIT
//
//nolint:gochecknoglobals,gochecknoinits // generated file
package docs

import "github.com/swaggo/swag"
Expand Down Expand Up @@ -164,13 +162,13 @@
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/errors.ErrorFields"
"$ref": "#/definitions/arcerrors.ErrorFields"
}
},
"465": {
"description": "ARC validation error",
"schema": {
"$ref": "#/definitions/errors.ErrorFields"
"$ref": "#/definitions/arcerrors.ErrorFields"
}
},
"500": {
Expand Down Expand Up @@ -214,10 +212,7 @@
"404": {
"description": "Not Found",
"schema": {
"type": "object",
"additionalProperties": {
"type": "string"
}
"$ref": "#/definitions/arcerrors.ErrorFields"
}
},
"500": {
Expand Down Expand Up @@ -302,21 +297,21 @@
"400": {
"description": "Bad Request",
"schema": {
"$ref": "#/definitions/errors.ErrorFields"
"$ref": "#/definitions/arcerrors.ErrorFields"
}
},
"465": {
"description": "ARC validation error",
"schema": {
"$ref": "#/definitions/errors.ErrorFields"
"$ref": "#/definitions/arcerrors.ErrorFields"
}
}
}
}
}
},
"definitions": {
"errors.ErrorFields": {
"arcerrors.ErrorFields": {
"type": "object",
"properties": {
"detail": {
Expand Down Expand Up @@ -414,6 +409,9 @@
"type": "integer"
}
},
"status": {
"type": "integer"
},
"timestamp": {
"type": "string"
},
Expand All @@ -437,7 +435,7 @@
}`

// SwaggerInfo holds exported Swagger Info so clients can modify it
var SwaggerInfo = &swag.Spec{

Check failure on line 438 in docs/docs.go

View workflow job for this annotation

GitHub Actions / 📊 Code Quality / ✨ Lint Code

SwaggerInfo is a global variable (gochecknoglobals)
Version: "0.1.0",
Host: "",
BasePath: "/",
Expand All @@ -450,6 +448,6 @@
RightDelim: "}}",
}

func init() {

Check failure on line 451 in docs/docs.go

View workflow job for this annotation

GitHub Actions / 📊 Code Quality / ✨ Lint Code

don't use `init` function (gochecknoinits)
swag.Register(SwaggerInfo.InstanceName(), SwaggerInfo)
}
Loading
Loading