Skip to content

Allow 0 restart delay#781

Merged
aluzzardi merged 1 commit into
moby:masterfrom
aaronlehmann:0-restartdelay
Jun 4, 2016
Merged

Allow 0 restart delay#781
aluzzardi merged 1 commit into
moby:masterfrom
aaronlehmann:0-restartdelay

Conversation

@aaronlehmann
Copy link
Copy Markdown
Collaborator

@aaronlehmann aaronlehmann commented Jun 3, 2016

This makes Restart.Delay and Restart.Window nullable by using the
Duration message type. Then the client can omit these fields to use the
default values. If 0 is explicitly specified, 0 is used, not the
default.

For consistency, switch all other time.Duration values in the protobufs
to use the Duration message type.

This also fixes an inconsistency introduced when the orchestrator was
changed to apply a default restart delay rather than doing this purely
client-side. The default wasn't being applied when handling tasks at
orchestrator startup.

Fixes #721

cc @aluzzardi

@docker-codecov-bot
Copy link
Copy Markdown

docker-codecov-bot commented Jun 3, 2016

Current coverage is 55.11%

Merging #781 into master will increase coverage by 1.96%

  1. 2 files (not in diff) in manager/controlapi were modified. more
    • Misses +5
    • Partials +1
    • Hits -6
  2. 4 files (not in diff) in manager were modified. more
    • Misses -14
    • Partials -4
    • Hits +15
  3. 2 files (not in diff) in ca were modified. more
    • Misses +4
    • Partials +4
    • Hits +6
  4. 2 files (not in diff) in agent/exec/container were modified. more
    • Misses -9
    • Partials -1
  5. 2 files (not in diff) in agent were modified. more
    • Misses +14
    • Partials +1
    • Hits -7
  6. File picker/picker.go (not in diff) was modified. more
    • Misses -7
    • Partials -1
    • Hits 0
  7. File .../test/deepcopy.pb.go (not in diff) was modified. more
    • Misses +10
    • Partials +6
    • Hits -16
  8. File spec/mounts.go (not in diff) was modified. more
    • Misses -11
    • Partials -8
    • Hits -27
  9. File agent/node.go (not in diff) was deleted. more
  10. File ioutils/ioutils.go (not in diff) was deleted. more
@@             master       #781   diff @@
==========================================
  Files            82         81     -1   
  Lines         11893      11724   -169   
  Methods           0          0          
  Messages          0          0          
  Branches          0          0          
==========================================
+ Hits           6321       6461   +140   
+ Misses         4720       4397   -323   
- Partials        852        866    +14   

Sunburst

Powered by Codecov. Last updated by dba157c...eecf9da

@stevvooe
Copy link
Copy Markdown
Contributor

stevvooe commented Jun 3, 2016

What's wrong with using a negative value to disable restart delay? I am not sure it is a good idea to introduce another level of objects.

@aaronlehmann
Copy link
Copy Markdown
Collaborator Author

@stevvooe: My main concern with doing this is that the client would have to explicitly translate user input of 0 to a negative value. If we forget to do this in some case, we'll get the wrong behavior. It's also counterintuitive to someone working with the API that specifying Restart.Delay = 0 wouldn't yield a value of 0. I like the explicitness of wrapping these values. Then we can tell the difference between a 0 value, and the value not being specified.

@aaronlehmann
Copy link
Copy Markdown
Collaborator Author

New plan: let's use the Duration message consistently instead of time.Duration: https://github.com/golang/protobuf/blob/master/ptypes/duration/duration.proto

I'll update the PR.

@aaronlehmann
Copy link
Copy Markdown
Collaborator Author

Updated

PTAL

@aaronlehmann aaronlehmann force-pushed the 0-restartdelay branch 2 times, most recently from 95fe98e to d0e8a60 Compare June 4, 2016 01:24
Comment thread api/dispatcher.proto Outdated
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

period in protobuf land.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thanks.

@stevvooe
Copy link
Copy Markdown
Contributor

stevvooe commented Jun 4, 2016

LGTM

This makes Restart.Delay and Restart.Window nullable by using the
Duration message type. Then the client can omit these fields to use the
default values. If 0 is explicitly specified, 0 is used, not the
default.

For consistency, switch all other time.Duration values in the protobufs
to use the Duration message type.

This also fixes an inconsistency introduced when the orchestrator was
changed to apply a default restart delay rather than doing this purely
client-side. The default wasn't being applied when handling tasks at
orchestrator startup.

Fixes #721

Signed-off-by: Aaron Lehmann <aaron.lehmann@docker.com>
@aluzzardi
Copy link
Copy Markdown
Member

LGTM

@aluzzardi aluzzardi merged commit 703b1e8 into moby:master Jun 4, 2016
@aluzzardi aluzzardi deleted the 0-restartdelay branch June 4, 2016 01:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Restart delay of 0 should be honored

5 participants