-
Notifications
You must be signed in to change notification settings - Fork 18.8k
Fix naivediffdriver timestamp precision bug #27209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -44,6 +44,7 @@ func NewNaiveDiffDriver(driver ProtoDriver, uidMaps, gidMaps []idtools.IDMap) Dr | |||
// Diff produces an archive of the changes between the specified | |||
// layer and its parent layer which may be "". | |||
func (gdw *NaiveDiffDriver) Diff(id, parent string) (arch archive.Archive, err error) { | |||
startTime := time.Now() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd propose to use time.Now().Truncate(time.Second)
here and startTime.Add(time.Second).Sub(time.Now())
in sleep. It looks more understandable to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
updated
Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com>
858d71f
to
d1a8305
Compare
LGTM |
1 similar comment
LGTM |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💯
@@ -44,6 +44,7 @@ func NewNaiveDiffDriver(driver ProtoDriver, uidMaps, gidMaps []idtools.IDMap) Dr | |||
// Diff produces an archive of the changes between the specified | |||
// layer and its parent layer which may be "". | |||
func (gdw *NaiveDiffDriver) Diff(id, parent string) (arch archive.Archive, err error) { | |||
startTime := time.Now() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cherry-pick from: moby#27209 Signed-off-by: Tonis Tiigi <tonistiigi@gmail.com> Signed-off-by: Lei Jitang <leijitang@huawei.com> (cherry picked from commit d1a8305)
Fixes #21555
This hack was suggested as a fix 6 months ago and as no better options have been brought up I suggest we merge it. At least temporarily.
Note that this doesn't sleep between every layer, only if there is a chance of this bug happening(very fast write in the beginning of a full second).
Signed-off-by: Tonis Tiigi tonistiigi@gmail.com