@@ -114,12 +114,13 @@ func (m *Manager) deferredSetUpCredentialHelpers(ctx context.Context, cliCfg *co
114
114
defer locker .Unlock ("gptscript-credential-helpers" )
115
115
116
116
// Load the last-checked file to make sure we haven't checked the repo in the last 24 hours.
117
+ now := time .Now ()
117
118
lastChecked , err := os .ReadFile (m .credHelperDirs .LastCheckedFile )
118
119
if err == nil {
119
- if t , err := time .Parse (time .RFC3339 , strings .TrimSpace (string (lastChecked ))); err == nil && time . Since (t ) < 24 * time .Hour {
120
+ if t , err := time .Parse (time .RFC3339 , strings .TrimSpace (string (lastChecked ))); err == nil && now . Sub (t ) < 24 * time .Hour {
120
121
// Make sure the binary still exists, and if it does, return.
121
122
if _ , err := os .Stat (filepath .Join (m .credHelperDirs .BinDir , "gptscript-credential-" + helperName + suffix )); err == nil {
122
- log .Debugf ("Credential helper %s up-to-date as of %v, checking for updates after %v" , helperName , t , lastChecked .Add (24 * time .Hour ))
123
+ log .Debugf ("Credential helper %s up-to-date as of %v, checking for updates after %v" , helperName , t , t .Add (24 * time .Hour ))
123
124
return nil
124
125
}
125
126
}
@@ -132,7 +133,7 @@ func (m *Manager) deferredSetUpCredentialHelpers(ctx context.Context, cliCfg *co
132
133
}
133
134
134
135
// Update the last-checked file.
135
- if err := os .WriteFile (m .credHelperDirs .LastCheckedFile , []byte (time . Now () .Format (time .RFC3339 )), 0644 ); err != nil {
136
+ if err := os .WriteFile (m .credHelperDirs .LastCheckedFile , []byte (now .Format (time .RFC3339 )), 0644 ); err != nil {
136
137
return err
137
138
}
138
139
0 commit comments