Skip to content

Commit

Permalink
ar: initialize allocwatcher on restore
Browse files Browse the repository at this point in the history
Fixes a panic. Left a comment on how the behavior could be improved, but
this is what releases <0.9.0 did.
  • Loading branch information
schmichael committed Oct 19, 2018
1 parent 41b40b9 commit 0536580
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -760,6 +760,11 @@ func (c *Client) restoreState() error {
var mErr multierror.Error
for _, alloc := range allocs {

//XXX On Restore we give up on watching previous allocs because
// we need the local AllocRunners initialized first. We could
// add a second loop to initialize just the alloc watcher.
prevAllocWatcher := allocwatcher.NoopPrevAlloc{}

c.configLock.RLock()
arConf := &allocrunner.Config{
Alloc: alloc,
Expand All @@ -769,6 +774,7 @@ func (c *Client) restoreState() error {
StateUpdater: c,
Consul: c.consulService,
Vault: c.vaultClient,
PrevAllocWatcher: prevAllocWatcher,
PluginLoader: c.config.PluginLoader,
PluginSingletonLoader: c.config.PluginSingletonLoader,
}
Expand Down

0 comments on commit 0536580

Please sign in to comment.