skillhub/github-sync-go/internal/github/request_control.go
XiaoSeS 2df4c913cb feat(github-sync): add continuous public repository discovery and skill sync
Signed-off-by: XiaoSeS <87064762+XiaoSeS@users.noreply.github.com>
2026-10-20 14:40:46 +08:00

16 lines
516 B
Go

package github
import "context"
type acquisitionControlKey struct{}
// WithAcquisitionControl composes platform stopping with the existing quota policy.
func WithAcquisitionControl(ctx context.Context, before func(context.Context) error) context.Context {
return context.WithValue(ctx, acquisitionControlKey{}, before)
}
func CheckAcquisitionControl(ctx context.Context) error {
if before, ok := ctx.Value(acquisitionControlKey{}).(func(context.Context) error); ok {
return before(ctx)
}
return ctx.Err()
}