Merge pull request #2105 from zhanglistar/master

1. modify unprotectedGenerateResizeJob to return early iif resizing job
This commit is contained in:
Travis Turner 2020-04-11 10:13:26 -05:00 • committed by GitHub
commit 72d5081a44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1195,6 +1195,9 @@ func (c *cluster) listenForJoins() {
// for future lookup by JobID.
func (c *cluster) unprotectedGenerateResizeJob(nodeAction nodeAction) (*resizeJob, error) {
c.logger.Printf("generateResizeJob: %v", nodeAction)
if c.currentJob != nil {
return nil, fmt.Errorf("there is currently a resize job running")
}
j, err := c.unprotectedGenerateResizeJobByAction(nodeAction)
if err != nil {
@ -1206,9 +1209,6 @@ func (c *cluster) unprotectedGenerateResizeJob(nodeAction nodeAction) (*resizeJo
c.jobs[j.ID] = j
// Set job as currentJob.
if c.currentJob != nil {
return nil, fmt.Errorf("there is currently a resize job running")
}
c.currentJob = j
return j, nil