MCPcopy Create free account
hub / github.com/MG-RAST/Shock / lock

Method lock

shock-server/node/locker/locker.go:88–104  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

86}
87
88func (n *NodeLock) lock() (err error) {
89 if lockDebug {
90 fmt.Printf("start NodeLock.lock gid=%d node=%s\n", getGID(), n.Id)
91 }
92 select {
93 case <-n.writeLock: // Grab the ticket - here is where we wait
94 case <-time.After(time.Minute * 30):
95 err = fmt.Errorf("Timeout!! Waited 30 mins on lock for node %s", n.Id)
96 return
97 }
98 n.IsLocked = true
99 n.Updated = time.Now()
100 if lockDebug {
101 fmt.Printf("end NodeLock.lock gid=%d node=%s\n", getGID(), n.Id)
102 }
103 return
104}
105
106func (n *NodeLock) unlock() {
107 if lockDebug {

Callers 1

LockNodeMethod · 0.80

Calls 1

getGIDFunction · 0.85

Tested by

no test coverage detected