mirror of
https://github.com/andwati/telecom-platform.git
synced 2026-11-01 09:32:15 +00:00
feat: Remove unused imports across charging engine modules
- Remove unused IntoResponse/warn/error/ChargingError/validate_* imports from api - Remove unused AsyncCommands/error/ChargingSession/ErrorContext imports from credit_management - Remove unused ErrorContext/ChargingError imports from engine - Remove unused ErrorContext import from rating_billing and prefix unused variables with underscore - Remove unused ErrorContext import from rating_plans_repo - Remove unused log_error/validate_amount/validate_im
This commit is contained in:
@@ -202,7 +202,13 @@ func (cs *ChaosService) GetActiveExperiments() []*Experiment {
|
||||
|
||||
experiments := make([]*Experiment, 0, len(cs.active))
|
||||
for _, exp := range cs.active {
|
||||
experiments = append(experiments, exp)
|
||||
// Create a copy to avoid race conditions
|
||||
copy := *exp
|
||||
if exp.Finished != nil {
|
||||
finished := *exp.Finished
|
||||
copy.Finished = &finished
|
||||
}
|
||||
experiments = append(experiments, ©)
|
||||
}
|
||||
return experiments
|
||||
}
|
||||
@@ -213,7 +219,16 @@ func (cs *ChaosService) GetExperimentStatus(id string) (*Experiment, bool) {
|
||||
defer cs.mu.RUnlock()
|
||||
|
||||
exp, exists := cs.active[id]
|
||||
return exp, exists
|
||||
if !exists {
|
||||
return nil, false
|
||||
}
|
||||
// Create a copy to avoid race conditions
|
||||
copy := *exp
|
||||
if exp.Finished != nil {
|
||||
finished := *exp.Finished
|
||||
copy.Finished = &finished
|
||||
}
|
||||
return ©, true
|
||||
}
|
||||
|
||||
// Middleware function to inject chaos into HTTP requests
|
||||
|
||||
Reference in New Issue
Block a user