Skip to content

Commit a6a598e

Browse files
committed
chore: changed the order of tasks in node start method
1 parent 5d178d1 commit a6a598e

File tree

2 files changed

+15
-16
lines changed

2 files changed

+15
-16
lines changed

cmd/start.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,8 @@ explicitly starts the node, and handles SIGINT/SIGTERM for graceful shutdown.`,
6969
return fmt.Errorf("failed to start node: %w", err)
7070
}
7171

72+
log.Info("Node started successfully")
73+
7274
// Channel to capture OS signals (SIGINT, SIGTERM).
7375
signalChan := make(chan os.Signal, 1)
7476
signal.Notify(signalChan, syscall.SIGINT, syscall.SIGTERM)

node/node.go

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -158,29 +158,26 @@ func (n *Node) Start(c *context.Context, errChan chan error) error {
158158
}()
159159

160160
go func() {
161-
// Register the node and update its details.
162-
if err := n.Register(c); err != nil {
163-
errChan <- fmt.Errorf("failed to register node: %w", err)
164-
return
165-
}
166-
if err := n.UpdateDetails(c); err != nil {
167-
errChan <- fmt.Errorf("failed to update node details: %w", err)
168-
return
169-
}
170-
171-
// Start the cron scheduler to execute periodic tasks.
172-
if err := n.Scheduler().Start(); err != nil {
173-
errChan <- fmt.Errorf("failed to start scheduler: %w", err)
174-
return
175-
}
176-
177161
// Start the HTTPS server using the configured TLS certificates and router.
178162
if err := utils.ListenAndServeTLS(n.ListenAddr(), n.TLSCertPath(), n.TLSKeyPath(), n.Router()); err != nil {
179163
errChan <- fmt.Errorf("failed to listen and serve tls: %w", err)
180164
return
181165
}
182166
}()
183167

168+
// Register the node and update its details.
169+
if err := n.Register(c); err != nil {
170+
return fmt.Errorf("failed to register node: %w", err)
171+
}
172+
if err := n.UpdateDetails(c); err != nil {
173+
return fmt.Errorf("failed to update node details: %w", err)
174+
}
175+
176+
// Start the cron scheduler to execute periodic tasks.
177+
if err := n.Scheduler().Start(); err != nil {
178+
return fmt.Errorf("failed to start scheduler: %w", err)
179+
}
180+
184181
return nil
185182
}
186183

0 commit comments

Comments
 (0)