Skip to content
This repository was archived by the owner on Mar 4, 2025. It is now read-only.

Commit fef1f4d

Browse files
committed
shared: use 1 second granularity for database change detection
1 parent 04809bf commit fef1f4d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

cmd/shared.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ func dbChanged(db string, meta metaData) (changed bool, err error) {
103103
}
104104
metaSHASum := c.Tree.Entries[0].Sha256
105105
metaFileSize := c.Tree.Entries[0].Size
106-
metaLastModified := c.Tree.Entries[0].LastModified.UTC()
106+
metaLastModified := c.Tree.Entries[0].LastModified.Truncate(time.Second).UTC()
107107

108108
// If the file size or last modified date in the metadata are different from the current file info, then the
109109
// local file has probably changed. Well, "probably" for the last modified day, but "definitely" if the file
@@ -116,8 +116,8 @@ func dbChanged(db string, meta metaData) (changed bool, err error) {
116116
return
117117
}
118118
fileSize := int(fi.Size())
119-
lastModified := fi.ModTime().UTC()
120-
if metaFileSize != fileSize || metaLastModified != lastModified {
119+
lastModified := fi.ModTime().Truncate(time.Second).UTC()
120+
if metaFileSize != fileSize || !metaLastModified.Equal(lastModified) {
121121
changed = true
122122
return
123123
}

0 commit comments

Comments
 (0)