Skip to content

Commit a6399aa

Browse files
committed
🐛 Fix weird cache invalidation bug for the query hub
1 parent 86e215a commit a6399aa

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

controller/run.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,14 @@ func Run(cmd *cobra.Command, args []string) error {
126126

127127
// Download the file if needed (or older than 1 day)
128128
secondsInDay := int64(60 * 60 * 24)
129-
if fileInfo, err := os.Stat(dest); err != nil || fileInfo.Size() == 0 || time.Now().Unix()-fileInfo.ModTime().Unix() > secondsInDay {
129+
fileInfo, err := os.Stat(dest)
130+
if err != nil || fileInfo.Size() == 0 || time.Now().Unix()-fileInfo.ModTime().Unix() > secondsInDay {
131+
// We first remove the file because it's outdated
132+
// and then we download it
133+
//
134+
// We have to do this because go-getter seems to not be able to overwrite the file
135+
// if it's already present
136+
os.Remove(dest) // Call it without checking the error
130137
client := &getter.Client{
131138
Src: urlToFetch,
132139
Dst: dest,

0 commit comments

Comments
 (0)