@rivascva/dt-idl 1.1.178 → 1.1.180

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/go/srv/srv.go CHANGED
@@ -13,8 +13,7 @@ import (
13
13
 
14
14
  // ListenAndServe starts the HTTP server and blocks until the context is cancelled.
15
15
  // It then gracefully shuts down allowing in-flight requests to complete.
16
- // The onShutdown functions are called after the server stops to clean up resources.
17
- func ListenAndServe(ctx context.Context, log log.Logger, srv *http.Server, onShutdown []func()) {
16
+ func ListenAndServe(ctx context.Context, log log.Logger, srv *http.Server) {
18
17
  // start the server in a separate goroutine
19
18
  go func() {
20
19
  log.Info(ctx, fmt.Sprintf("server running on %s", srv.Addr))
@@ -28,18 +27,13 @@ func ListenAndServe(ctx context.Context, log log.Logger, srv *http.Server, onShu
28
27
  log.Info(ctx, "shutting down gracefully...")
29
28
 
30
29
  // give in-flight requests time to complete
31
- shutdownCtx, cancel := utils.DetachContext(ctx, 10*time.Second)
30
+ detachedCtx, cancel := utils.DetachContext(ctx, 10*time.Second)
32
31
  defer cancel()
33
32
 
34
33
  // shutdown the server
35
- if err := srv.Shutdown(shutdownCtx); err != nil {
34
+ if err := srv.Shutdown(detachedCtx); err != nil {
36
35
  log.Error(ctx, err)
37
36
  }
38
37
 
39
- // run cleanup functions
40
- for _, fn := range onShutdown {
41
- fn()
42
- }
43
-
44
38
  log.Info(ctx, "server stopped")
45
39
  }
@@ -93,7 +93,7 @@ func DetachContext(ctx context.Context, timeout time.Duration) (context.Context,
93
93
  return context.WithTimeout(context.WithoutCancel(ctx), timeout)
94
94
  }
95
95
 
96
- // NewServerContext returns a new context that is canceled when the server receives an interrupt or kill signal.
96
+ // NewServerContext returns a new context that is canceled when the server receives an interrupt or termination signal.
97
97
  // The context is returned along with a cancel function that can be used to cancel the context manually.
98
98
  // It is recommended to use this context as the base context for a server and defer the cancel function.
99
99
  func NewServerContext() (context.Context, context.CancelFunc) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivascva/dt-idl",
3
- "version": "1.1.178",
3
+ "version": "1.1.180",
4
4
  "description": "Dream Trade - Interface Definition Language",
5
5
  "main": "dist/index.cjs.js",
6
6
  "module": "dist/index.esm.js",