mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-23 08:08:45 +05:00
Guardian - avoid using defer to speed up a bit
This commit is contained in:
@@ -83,7 +83,6 @@ func (guard *GuardianLock) unlockItems(itmLocks []*itemLock) {
|
||||
|
||||
func (guard *GuardianLock) Guard(handler func() (interface{}, error), timeout time.Duration, lockIDs ...string) (reply interface{}, err error) {
|
||||
itmLocks := guard.lockItems(lockIDs)
|
||||
defer guard.unlockItems(itmLocks)
|
||||
|
||||
rplyChan := make(chan interface{})
|
||||
errChan := make(chan error)
|
||||
@@ -109,6 +108,7 @@ func (guard *GuardianLock) Guard(handler func() (interface{}, error), timeout ti
|
||||
}
|
||||
}
|
||||
|
||||
guard.unlockItems(itmLocks)
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user