GetRevisionSummary без preview_fragments; boundedRepoCtx для GetRevision; parallel CDN prefetch с ctx из ingest. Co-authored-by: Cursor <[email protected]>
20 lines
433 B
Go
20 lines
433 B
Go
package repository
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
)
|
|
|
|
const defaultRepoTimeout = 60 * time.Second
|
|
|
|
// boundedRepoCtx returns a context with default repository I/O timeout.
|
|
func boundedRepoCtx(parent context.Context) (context.Context, context.CancelFunc) {
|
|
if parent == nil {
|
|
parent = context.Background()
|
|
}
|
|
if _, ok := parent.Deadline(); ok {
|
|
return parent, func() {}
|
|
}
|
|
return context.WithTimeout(parent, defaultRepoTimeout)
|
|
}
|