imbajin commented on code in PR #336:
URL:
https://github.com/apache/incubator-hugegraph-computer/pull/336#discussion_r2422711697
##########
vermeer/apps/master/bl/scheduler_bl.go:
##########
@@ -72,81 +225,161 @@ func (s *ScheduleBl) QueueTask(taskInfo
*structure.TaskInfo) (bool, error) {
return false, errors.New("the property `SpaceName` of taskInfo
is empty")
}
- //defer s.Unlock(s.Lock())
+ defer s.Unlock(s.Lock())
Review Comment:
**Unconventional use of defer with unlock pattern**
The pattern `defer s.Unlock(s.Lock())` is unusual and may be confusing.
While it works, it evaluates `s.Lock()` immediately and schedules the unlock
for later.
**Suggested alternative:**
```go
s.Lock()
defer s.Unlock(nil)
```
Or use a more conventional pattern:
```go
s.locker.Lock()
defer s.locker.Unlock()
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]