Skip to content

Commit

Permalink
Pulling down Shock node parts information inside of Lock so that ther…
Browse files Browse the repository at this point in the history
…e is no concurrency issues with updating the node object.
  • Loading branch information
jaredbischof committed May 19, 2015
1 parent da8335a commit 760c0f2
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions shock-server/node/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,16 @@ func (node *Node) Update(params map[string]string, files FormFiles) (err error)
return errors.New("This is not a parts node and thus does not support uploading in parts.")
}
LockMgr.LockPartOp()

// Refresh parts information after locking, before saving.
// Load node by id
n, err := Load(node.Id)
if err != nil {
LockMgr.UnlockPartOp()
return err
}
node.Parts = n.Parts

if node.Parts.Count > 0 || node.Parts.VarLen {
for key, file := range files {
keyn, errf := strconv.Atoi(key)
Expand Down

0 comments on commit 760c0f2

Please sign in to comment.