Skip to content

Commit e9fb2d8

Browse files
committed
tq/transfer_queue.go: fix retry delay trace log
In PR git-lfs#3449 we added support for the detection of 429 HTTP status code responses to either Git LFS Batch API requests or individual object transfer requests, with an implementation which expected a Retry-After header with a specified retry time or delay period. Commit 2197f76 of that PR introduced two trace log output statements which attempted to report the delay period calculated from the Retry-After header, one each in the enqueueAndCollectRetriesFor() and handleTransferResult() methods of the TransferQueue structure in our "tq" package. Both of these statements attempted to format a value of the Duration type (from the "time" package of the Go standard library) into a number of seconds, expressed as a string, for their trace log messages. However, the type returned by the Seconds() method of the Duration type is a float64 type, so the trace log messages would contain format error markers along with the floating-point value, for instance, "%!s(float64=8.999544366) seconds". The format string for one of these trace log output statements was later updated in commit cf02216 of PR git-lfs#4097, when an exponential backoff technique was introduced to better respect servers which sent responses with 429 status codes but no Retry-After headers. Specifically, the trace log message in the enqueueAndCollectRetriesFor() method was revised to replace the "%s" formatting verb for the float64 return type from the Duration type's Seconds() method with a "%.2f" verb, which correctly converts the float64 value into a string. We now correct the related trace log message in the handleTransferResult() to use the same "%2f" formatting verb for the return type from the Duration type's Seconds() method. We also adjust the text of the message slightly to align more closely with the corresponding message in the enqueueAndCollectRetriesFor() method.
1 parent 4ecc35f commit e9fb2d8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

tq/transfer_queue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ func (q *TransferQueue) handleTransferResult(
806806
// If the object can't be retried now, but can be
807807
// after a certain period of time, send it to
808808
// the retry channel with a time when it's ready.
809-
tracerx.Printf("tq: retrying object %s after %s seconds.", oid, time.Until(readyTime).Seconds())
809+
tracerx.Printf("tq: retrying object %s after %.2fs", oid, time.Until(readyTime).Seconds())
810810
q.trMutex.Lock()
811811
objects, ok := q.transfers[oid]
812812
q.trMutex.Unlock()

0 commit comments

Comments
 (0)