Skip to content

Commit 1feb12f

Browse files
committed
Merge pull request #6 from QuentinPerez/fix-3
stop sleeping :)
2 parents 4fb02a9 + 3c015bb commit 1feb12f

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,7 @@ $> curl --silent http://212.47.248.251 | head -n1 # you can also open your brows
117117

118118
### master (unreleased)
119119

120+
* Sleep only when we stop an host ([#4](https://github.com/scaleway/docker-machine-driver-scaleway/issues/4))
120121
* Support of `create`
121122
* Support of `start`
122123
* Support of `stop`

driver/scaleway.go

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ type Driver struct {
3434
Token string
3535
commercialType string
3636
name string
37+
stopping bool
3738
// size string
3839
// userDataFile string
3940
// ipv6 bool
@@ -178,7 +179,9 @@ func (d *Driver) GetState() (st state.State, err error) {
178179
case "stopped":
179180
st = state.Stopped
180181
}
181-
time.Sleep(5 * time.Second)
182+
if d.stopping {
183+
time.Sleep(5 * time.Second)
184+
}
182185
return
183186
}
184187

@@ -240,5 +243,6 @@ func (d *Driver) Start() error {
240243

241244
// Stop stops the server
242245
func (d *Driver) Stop() error {
246+
d.stopping = true
243247
return d.postAction("poweroff")
244248
}

0 commit comments

Comments
 (0)