Skip to content

Commit 51d18c7

Browse files
refactor: rename CreateLocal to NewLocalManager and update return types
- Renamed CreateLocal method to NewLocalManager for clarity. - Updated return type from *types.LocalManager to *interfaces.LocalGoroutineManagerInterface. - Adjusted documentation to reflect changes in method name and return type.
1 parent 8d50acf commit 51d18c7

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

manager/app/appmanager.go

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ func (AM *AppManagerStruct) Shutdown(safe bool) error {
190190
return nil
191191
}
192192

193-
// CreateLocal creates a new local manager within this app manager.
193+
// NewLocalManager creates a new local manager within this app manager.
194194
// A local manager is used to organize and manage goroutines for a specific module or file.
195195
//
196196
// Parameters:
@@ -202,16 +202,16 @@ func (AM *AppManagerStruct) Shutdown(safe bool) error {
202202
// - Records metrics for the create operation
203203
//
204204
// Returns:
205-
// - *types.LocalManager: The initialized local manager instance
205+
// - *interfaces.LocalGoroutineManagerInterface: The initialized local manager instance
206206
// - error: Returns error if local manager creation fails or if not found
207207
//
208208
// Example:
209209
//
210-
// localMgr, err := appMgr.CreateLocal("http-handlers")
210+
// localMgr, err := appMgr.NewLocalManager("http-handlers")
211211
// if err != nil {
212212
// log.Fatalf("Failed to create local manager: %v", err)
213213
// }
214-
func (AM *AppManagerStruct) CreateLocal(localName string) (*types.LocalManager, error) {
214+
func (AM *AppManagerStruct) NewLocalManager(localName string) (*interfaces.LocalGoroutineManagerInterface, error) {
215215
startTime := time.Now()
216216
defer func() {
217217
duration := time.Since(startTime)
@@ -224,16 +224,13 @@ func (AM *AppManagerStruct) CreateLocal(localName string) (*types.LocalManager,
224224
metrics.RecordOperationError("manager", "create_local", "local_manager_not_found")
225225
return nil, errors.ErrLocalManagerNotFound
226226
}
227-
Manager, err := localManager.CreateLocal(localName)
227+
_, err := localManager.CreateLocal(localName)
228228
if err != nil {
229229
metrics.RecordOperationError("manager", "create_local", "create_failed")
230230
return nil, err
231231
}
232232

233-
// Record operation
234-
metrics.RecordManagerOperation("local", "create", AM.AppName)
235-
236-
return Manager, nil
233+
return &localManager, nil
237234
}
238235

239236
// GetAllLocalManagers retrieves all local managers registered with this app manager.

0 commit comments

Comments
 (0)