Skip to content

Converge CancelCheckInterval into a common constant#143

Open
yushan8 wants to merge 7 commits into
mainfrom
yushan/ctx-cancel
Open

Converge CancelCheckInterval into a common constant#143
yushan8 wants to merge 7 commits into
mainfrom
yushan/ctx-cancel

Conversation

@yushan8

@yushan8 yushan8 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Converge CancelCheckInterval into a common constant. Move service related constants to service_config.go.

@yushan8 yushan8 requested review from a team as code owners July 6, 2026 17:08
Comment thread core/targethasher/BUILD.bazel Outdated
Comment thread core/common/utils.go Outdated
@yushan8 yushan8 force-pushed the yushan/ctx-cancel branch from 931eceb to 35ec09a Compare July 7, 2026 05:29
Comment thread core/errors/errors.go
// CancelCheckInterval is how often we poll ctx.Err() inside per-target hot loops.
// Picked to keep overhead negligible while still surfacing cancellation in <100ms
// for typical target rates.
CancelCheckInterval = 4096

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prior we were using 1024 with this comment. Should we not converge on the smaller of the two? The cost of doing the check is almost negligible?

Comment thread core/errors/errors.go
@@ -0,0 +1,8 @@
package errors

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this really an error package? Should it be some constant package instead

Comment thread core/common/utils.go

// chunk targets into multiple messages for streaming
responses := chunkTargets(optimizedTargets, DefaultTargetChunkSize)
responses := chunkTargets(optimizedTargets, config.DefaultTargetChunkSize)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this not use the service config value? If someone specified in their config, then it would get ignored here and instead use the default value still.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants