MCPcopy Create free account
hub / github.com/Thunder-Compute/thunder-cli / parseRetryAfter

Function parseRetryAfter

api/client.go:154–172  ·  view source on GitHub ↗
(value string, now time.Time)

Source from the content-addressed store, hash-verified

152}
153
154func parseRetryAfter(value string, now time.Time) (time.Duration, bool) {
155 value = strings.TrimSpace(value)
156 if value == "" {
157 return 0, false
158 }
159
160 if seconds, err := strconv.ParseInt(value, 10, 64); err == nil && seconds >= 0 {
161 return time.Duration(seconds) * time.Second, true
162 }
163
164 retryAt, err := http.ParseTime(value)
165 if err != nil {
166 return 0, false
167 }
168 if retryAt.Before(now) {
169 return 0, true
170 }
171 return retryAt.Sub(now), true
172}
173
174// sortedInstances converts a map keyed by ID into a sorted slice.
175func sortedInstances(raw map[string]Instance) []Instance {

Callers 1

doRequestMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected